import jenkins.model.Jenkins import org.codefirst.SimpleThemeDecorator 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; } body, #page-body, #page-header, #header, #main-panel, #main-panel-content, #side-panel, .top-sticker-inner, .bottom-sticker-inner, #breadcrumbBar, #breadcrumbs { background-color: var(--atlas-bg) !important; color: var(--atlas-text) !important; } #side-panel .task-link, #breadcrumbs a, #breadcrumbs, #projectstatus th a, #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; } table.pane tr:nth-child(even) td, #projectstatus tr:hover td { background-color: var(--atlas-surface-alt) !important; } input, select, textarea, #search-box { background-color: var(--atlas-surface-alt) !important; color: var(--atlas-text) !important; border-color: var(--atlas-border) !important; } #header, #page-header { background-color: #202734 !important; } #header .login, #page-header .login { color: var(--atlas-text) !important; } #side-panel .task-link, #side-panel .task-link:visited, #side-panel .task-link:hover { color: var(--atlas-text) !important; } #footer { background-color: var(--atlas-bg) !important; color: var(--atlas-text-muted) !important; } .jenkins_ver:after { content: "atlas dark"; } """.stripIndent().trim()) theme.setJsUrl("") instance.save() println("Applied simple-theme-plugin dark theme") } else { println("simple-theme-plugin not installed; skipping theme configuration") }