-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CSS variables - prerequisite for Dark mode #4752
Conversation
I was going to test this on windows but with the current tip, it doesnt work on windows
|
@@ -109,7 +109,7 @@ | |||
|
|||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I’d forgotten about the admin monitor issue, and I hadn’t checked the CLI page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you’re right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just go ahead and create a big & comprehensive variables.less
file and be done with it :D
@@ -3,7 +3,7 @@ | |||
|
|||
.ui-refresh { | |||
.page-header { | |||
background-color: @header-bg-v2; | |||
background-color: var(--header-bg-v2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if we should just override the :root
variable here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you need to create this? Does this fix something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -109,7 +109,7 @@ | |||
|
|||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retested up to c12b42c
With IE11 things look ok there
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defined but never used, also naming inconsistent with other variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed IMO
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
historical most likely, not intentional as far as I know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 entries
section 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 entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).