From 0bb45bca838ca082cffdd299ebfce52c081d97c9 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Tue, 20 Jan 2026 18:13:49 -0300 Subject: [PATCH] jenkins: fix dark theme injection --- services/jenkins/scripts/theme.groovy | 140 +++++++++++++++----------- 1 file changed, 83 insertions(+), 57 deletions(-) diff --git a/services/jenkins/scripts/theme.groovy b/services/jenkins/scripts/theme.groovy index b20169c..58755c0 100644 --- a/services/jenkins/scripts/theme.groovy +++ b/services/jenkins/scripts/theme.groovy @@ -1,21 +1,46 @@ import jenkins.model.Jenkins import org.codefirst.SimpleThemeDecorator +import org.jenkinsci.plugins.simpletheme.CssTextThemeElement def instance = Jenkins.get() def decorators = instance.getExtensionList(SimpleThemeDecorator.class) if (decorators?.size() > 0) { def theme = decorators[0] - theme.setCssUrl("https://cdn.jsdelivr.net/gh/Jorg3Lucas/jenkins-modern-themes@main/dist/modern-blue-grey.css") - theme.setCssRules(""" -:root { - --atlas-bg: #0f1216; - --atlas-surface: #171b21; - --atlas-surface-alt: #1f252d; - --atlas-border: #2b313b; - --atlas-text: #e6e9ef; - --atlas-text-muted: #b3bac6; - --atlas-link: #8fb7ff; + def cssRules = """ +:root, +.app-theme-picker__picker[data-theme=none] { + --background: #0f1216 !important; + --header-background: #141922 !important; + --header-border: #2b313b !important; + --white: #141922 !important; + --black: #e6e9ef !important; + --very-light-grey: #171b21 !important; + --light-grey: #202734 !important; + --medium-grey: #2b313b !important; + --dark-grey: #0b0f14 !important; + --text-color: #e6e9ef !important; + --text-color-secondary: #a6adba !important; + --card-background: #171b21 !important; + --card-border-color: #2b313b !important; + --pane-header-bg: #1f252d !important; + --pane-header-border-color: #2b313b !important; + --pane-border-color: #2b313b !important; + --pane-text-color: #e6e9ef !important; + --pane-header-text-color: #e6e9ef !important; + --link-color: #8fb7ff !important; + --link-color--hover: #b0ccff !important; + --link-dark-color: #e6e9ef !important; + --link-dark-color--hover: #b0ccff !important; + --input-color: #151a20 !important; + --input-border: #2b313b !important; + --input-border-hover: #3a424d !important; + --button-background: #232a33 !important; + --button-background--hover: #2b313b !important; + --button-background--active: #323b46 !important; + --item-background--hover: #232a33 !important; + --item-background--active: #2b313b !important; + --accent-color: #8fb7ff !important; } body, @@ -29,83 +54,84 @@ body, .bottom-sticker-inner, #breadcrumbBar, #breadcrumbs { - background-color: var(--atlas-bg) !important; - color: var(--atlas-text) !important; + background-color: var(--background) !important; + color: var(--text-color) !important; } -#side-panel .task-link, -#breadcrumbs a, -#breadcrumbs, -#projectstatus th a, +.jenkins-card, +.jenkins-section, +.jenkins-section__item, +#main-panel .jenkins-card, +#main-panel .jenkins-section { + background-color: var(--card-background) !important; + color: var(--text-color) !important; + border-color: var(--card-border-color) !important; +} + +table.pane, +table.pane td, +table.pane th, #projectstatus td, #projectstatus th { - color: var(--atlas-text-muted) !important; -} - -a, -a:visited, -a:link { - color: var(--atlas-link) !important; -} - -a:hover { - opacity: 0.85; -} - -#main-panel, -#main-panel-content, -#description, -.pane, -table.pane { - background-color: var(--atlas-surface) !important; - color: var(--atlas-text) !important; -} - -table.pane tr:nth-child(odd) td { - background-color: var(--atlas-surface) !important; + background-color: var(--card-background) !important; + color: var(--text-color) !important; } table.pane tr:nth-child(even) td, #projectstatus tr:hover td { - background-color: var(--atlas-surface-alt) !important; + background-color: #1f252d !important; } input, select, textarea, #search-box { - background-color: var(--atlas-surface-alt) !important; - color: var(--atlas-text) !important; - border-color: var(--atlas-border) !important; + background-color: #151a20 !important; + color: var(--text-color) !important; + border-color: var(--input-border) !important; } -#header, -#page-header { - background-color: #202734 !important; +a, +a:visited, +a:link { + color: var(--link-color) !important; } -#header .login, -#page-header .login { - color: var(--atlas-text) !important; +a:hover { + opacity: 0.85; } #side-panel .task-link, -#side-panel .task-link:visited, -#side-panel .task-link:hover { - color: var(--atlas-text) !important; +#breadcrumbs a, +#breadcrumbs, +#projectstatus th a { + color: var(--text-color-secondary) !important; +} + +.console-output, +.console-output pre, +pre, +code, +.CodeMirror { + background-color: #0c0f14 !important; + color: #d9dee7 !important; } #footer { - background-color: var(--atlas-bg) !important; - color: var(--atlas-text-muted) !important; + background-color: var(--background) !important; + color: var(--text-color-secondary) !important; } .jenkins_ver:after { content: "atlas dark"; } -""".stripIndent().trim()) +""".stripIndent().trim() + + theme.setElements([new CssTextThemeElement(cssRules)]) + theme.setCssUrl("") + theme.setCssRules(cssRules) theme.setJsUrl("") - instance.save() + theme.save() println("Applied simple-theme-plugin dark theme") } else { println("simple-theme-plugin not installed; skipping theme configuration")