Add CSS variables - prerequisite for Dark mode #4752
Add CSS variables - prerequisite for Dark mode #4752timja merged 31 commits intojenkinsci:masterfrom
Conversation
|
I was going to test this on windows but with the current tip, it doesnt work on windows |
| #menuSelector {/* used for showing 'v' on the right of the anchor */ | ||
| background-color:transparent; | ||
| background-image: url(menu_down_arrow.png); | ||
| background-image: var(--menu-selector-down-background-image); |
There was a problem hiding this comment.
Seems to work on i.e but the entire dark theme doesn't
It's not expected to work on IE 11 at all for the theme
Here is a side by side with ie11 on the left and edge on the right
That's not working, at least for fonts, the preprocessor isn't picking them up 😢,
Two options I guess,
- this work doesn't really require the fonts to be changeable at runtime, so it could go back to less variables
- try out the other postcss plugin and see if that handles fonts, this one only seems to handle colours
cc @fqueiruga
There was a problem hiding this comment.
Some more observations I made:
- The administrative monitor (The bell thing in the top right) still shows white background on the dark theme
- CLI page has black text with dark theme.
There was a problem hiding this comment.
Thanks I’d forgotten about the admin monitor issue, and I hadn’t checked the CLI page
There was a problem hiding this comment.
BTW I would not bother converting the arrow to a CSS variables. It should be either an icon or a CSS triangle, not an image anyway.
There was a problem hiding this comment.
This reverts commit a9b9310.
|
I don't think we should go all in CSS variables. For example, I would keep font-family and font-size in less variables for now. In the first iteration I'd keep it simple: colors, backgrounds, borders and maybe font weights. |
| @line-height-heading: 1.2; | ||
| body { | ||
| // Font related properties | ||
| --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; |
There was a problem hiding this comment.
Maybe the fact that the variables are declared here and not in :root is causing the fallback issues. Just some brainstorming.
There was a problem hiding this comment.
Maybe we should just go ahead and create a big & comprehensive variables.less file and be done with it :D
| .ui-refresh { | ||
| .page-header { | ||
| background-color: @header-bg-v2; | ||
| background-color: var(--header-bg-v2); |
There was a problem hiding this comment.
I don't know if we should just override the :root variable here
There was a problem hiding this comment.
hmm? not quite sure what you mean
| @line-height-heading: 1.2; | ||
| body { | ||
| // Font related properties | ||
| --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; |
There was a problem hiding this comment.
Maybe we should just go ahead and create a big & comprehensive variables.less file and be done with it :D
war/src/main/less/base/style.less
Outdated
| box-shadow: var(--menu-box-shadow); | ||
| } | ||
|
|
||
| #jenkins.yui-skin-sam { |
There was a problem hiding this comment.
Why did you need to create this? Does this fix something?
There was a problem hiding this comment.
it allows overriding the yui-skin in themes, I've matched the css below to what the yui skin provides and extended it with variables
| #menuSelector {/* used for showing 'v' on the right of the anchor */ | ||
| background-color:transparent; | ||
| background-image: url(menu_down_arrow.png); | ||
| background-image: var(--menu-selector-down-background-image); |
There was a problem hiding this comment.
BTW I would not bother converting the arrow to a CSS variables. It should be either an icon or a CSS triangle, not an image anyway.
|
Deployed the current commit to https://repo.jenkins-ci.org/snapshots/org/jenkins-ci/main/jenkins-war/2.239-SNAPSHOT/jenkins-war-2.239-20200527.181313-1.war , for testing in jenkinsci/dark-theme-plugin#8 |
|
There are some variables that use |
Agreed, most of the bg ones came from the existing sass variables and I didn't touch them in the find / replace, When I created new ones I added them with background, happy to shorten though |
|
Created a PR against this branch timja#3 |
|
Another PR created against this branch timja#4 |
|
Created another PR, forgot one variable timja#6 😓 |
|
I'll start working on the dark mode variables for these changes |
|
I've updated the changelog PTAL |
|
Some shuffling done in 49e501f mostly moves yui customisation code to one place, as there was some in styles.less as well I removed a bit of duplication between the search bar and other autocompletes, and pulled in some of the enhancements that were added to search but not others. I've tested it on the add job, copy items from widget |
|
We may merge it in 24 hours if no negative feedback or requests to extend the review time. Please see the merge process documentation for more information Thanks to @timja @95jonpet @fqueiruga @res0nance @EstherAF @nimishbongale who contributed to the Dark Theme implementation and evaluation, and to compatibility testing of this pull request! It is great to see such a major improvement to Jenkins UX and CSS extensibility delivered in a few days. 🥇 🙇 🚀 |
|
jenkinsci/dark-theme-plugin#60 updates the demo for testing to the recent version |
|
so not a blocker but a few concerns:
|
|
| // Side panel | ||
| --panel-border-color: #eaeff2; | ||
| --panel-border-color--hover: #cecece; | ||
| --side-panel-hover-color: var(--panel-border-color); |
There was a problem hiding this comment.
Defined but never used, also naming inconsistent with other variables.
| border-color: @btn-primary-bg; | ||
| color: var(--btn-text-color); | ||
| background-color: var(--btn-primary-bg); | ||
| border-color: var(--btn-primary-bg); |
There was a problem hiding this comment.
Is it deliberate that here and further below, we're not using a separate variable for the primary button border? Secondary buttons have a separate variable.
There was a problem hiding this comment.
historical most likely, not intentional as far as I know
There was a problem hiding this comment.
Button variable API should be expanded IMO


See JENKINS-XXXXX.
This is being used to deliver dark mode, see https://github.com/jenkinsci/dark-theme
Testing
It would be great if someone can check this in IE 11, CSS variables aren't supported there but I've added a postcss plugin that has resolved the variables at build time, I've checked the properties are present in the CSS.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entriessection only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge:Proposed changelog entriesare correctupgrade-guide-neededlabel is set and there is aProposed upgrade guidelinessection in the PR title. (example)lts-candidateto be considered (see query).