Repository navigation
fix(core): TitleBar title follows headerText and headerNotActiveText - #590
Conversation
|
|
ac114a3 to
0bd4528
Compare
|
Thanks, @Exalt24! Great write-up, and the per-theme contrast table is really useful. One change before merging: could you drop the variable and keep the text visible, drawing the faux bold with a single 1px shadow? There are still two copies of each letter, 1px apart, like before: // the text and a 1px shadow draw the faux-bold title, in the bar's color
textShadow: '1px 0px currentColor',The title then inherits In Chromium it looks the same as the current render, only 0.5px to the left. Since you already have the setup, could you check Firefox and WebKit too? |
|
Done. The title keeps its text and draws the bold with The TitleBar stories pass in Chromium, Firefox and WebKit. Rendered at 4x in each (default theme, active and inactive), the new title is the old one moved 0.5px to the left, and after that shift it is pixel for pixel the same. With a tomato bar and |
The title's letters are drawn by two text shadows over transparent text, and both were hard-coded white, so neither text token ever reached it. The bar now sets a titleColor variable to headerText (headerNotActiveText when inactive) and the shadows use it. The Simple and Inactive stories check the shadow colors. Fixes #580
The title keeps its own text and draws the faux bold with one 1px shadow in currentColor, so it takes headerText or headerNotActiveText from the bar without a variable. The stories now check the token as the text color and a 1px shadow in it.
c7e1d64 to
99ffcd6
Compare
|
View your CI Pipeline Execution ↗ for commit 99ffcd6
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
|
Thanks, @Exalt24! Merged, the TitleBar title now follows @all-contributors please add @Exalt24 for code |
|
I've put up a pull request to add @Exalt24! 🎉 |
Fixes #580
demo_final.mp4
The title draws its letters with two text shadows over transparent text, and both shadows were hard-coded
white, soheaderTextandheaderNotActiveTextnever reached it. The title was white in every theme, active or not.The title now keeps its text visible and draws the faux bold with a single shadow,
textShadow: '1px 0px currentColor', so it takes the bar'sheaderTextorheaderNotActiveTextby inheritance. That is the approach suggested in review; my first version put a variable on the bar and left the text transparent. The letters sit 0.5px further left than in the old render, since the old shadows were at 0.5px and 1.5px. After that shift the title is pixel for pixel the same in Chromium, Firefox and WebKit, at 4x, in the default theme, active and inactive.These two tokens weren't used before, so some themes look different now. In the default theme the active title goes from
#fffto#fefefe(no visible change) and the inactive one from white to#c6c6c6, which is closer to how Windows 95 draws it. I didn't touch any token.I computed the contrast of the title against its bar from the token files, for the 33 of 35 themes where both colors are plain hex (the others have a gradient or a transparent bar). The active title is below 3:1 in 3 themes before and 3 after, but not the same 3:
olive(1.4 to 15.3) andpamelaAnderson(2.1 to 9.8) get better,violetDark(10.2 to 2.0) andmodernDark(8.4 to 1.9) get worse. The inactive title is below 3:1 in 6 themes before and 27 after.Contrast per theme (title against its bar)
The
SimpleandInactivestories check the title's color and shadow against the two tokens. They fail on the old stylesheet, and also when the shadow goes back to white, moves to another offset or the text goes transparent again. The story suite passes (50 tests in 22 files), andtscand eslint are clean. A custom bar (tomato, with#1a1a1atext) is followed by the title and its shadow in Chromium, Firefox and WebKit.