Skip to content

fix(core): TitleBar title follows headerText and headerNotActiveText - #590

Merged
ggdaltoso merged 2 commits into
React95:masterfrom
Exalt24:fix/titlebar-title-color
Nov 9, 2026
Merged

ggdaltoso merged 2 commits into
React95:masterfrom
Exalt24:fix/titlebar-title-color

Conversation

@Exalt24

@Exalt24 Exalt24 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #580

demo_final.mp4

The title draws its letters with two text shadows over transparent text, and both shadows were hard-coded white, so headerText and headerNotActiveText never 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's headerText or headerNotActiveText by 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 #fff to #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) and pamelaAnderson (2.1 to 9.8) get better, violetDark (10.2 to 2.0) and modernDark (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)
theme active before active after inactive before inactive after
azureOrange 18.41 18.41 6.08 1.60
bee 18.36 13.79 4.15 2.30
blackAndWhite 21.00 21.00 1.00 21.00
brick 9.75 9.75 3.58 1.92
candy 8.59 7.58 3.28 2.26
coldGray 10.31 8.12 5.49 2.25
counterStrike 7.56 7.49 7.56 1.82
eggplant 4.46 4.46 2.38 1.88
highContrast 8.43 8.43 4.00 2.58
lilac 6.47 6.47 4.00 2.58
lilacRoseDark 15.56 8.22 8.25 2.03
maple 9.75 9.75 2.60 2.04
marine 16.01 16.01 4.00 2.58
matrix 21.00 8.73 4.00 1.92
millenium n/a n/a 4.00 2.59
modernDark 8.39 1.91 n/a n/a
molecule 6.44 5.87 4.00 2.23
ninjaTurtles 3.86 3.86 4.00 5.24
olive 1.37 15.30 8.87 2.09
pamelaAnderson 2.14 9.82 3.62 1.04
plum 9.69 9.69 5.81 4.27
rainyDay 6.12 6.12 4.00 2.60
rose 4.74 4.74 2.62 2.40
slate 4.33 4.24 3.99 2.22
spruce 3.54 3.50 3.99 2.90
storm n/a n/a n/a n/a
theSixtiesUSA 15.93 15.93 5.98 2.84
tokyoDark 16.01 14.50 5.67 5.13
tooSexy 16.95 15.13 14.50 2.10
travel 8.69 5.70 7.03 1.84
vaporTeal 6.21 5.07 1.94 3.20
vermillion 20.88 17.53 9.81 8.24
violetDark 10.18 2.01 18.23 1.83
water 2.38 2.38 2.71 1.75
win95 15.63 15.49 4.29 2.51

The Simple and Inactive stories 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), and tsc and eslint are clean. A custom bar (tomato, with #1a1a1a text) is followed by the title and its shadow in Chromium, Firefox and WebKit.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ggdaltoso

ggdaltoso commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

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 headerText / headerNotActiveText from the bar, so createVar and the vars in the recipe can go. The story checks would follow: color becomes the token instead of transparent, and the shadow becomes ${color} 1px 0px 0px.

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?

@Exalt24

Exalt24 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Done. The title keeps its text and draws the bold with textShadow: '1px 0px currentColor', so it inherits the bar's color. createVar and the recipe vars are gone, and the stories now expect the token as the color and <color> 1px 0px 0px as the shadow.

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 #1a1a1a text, the title and its shadow follow the bar in all three.

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.
@ggdaltoso
ggdaltoso force-pushed the fix/titlebar-title-color branch from c7e1d64 to 99ffcd6 Compare November 9, 2026 12:06
@nx-cloud

nx-cloud Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 99ffcd6

Command Status Duration Result
nx affected -t lint,test,build,test-storybook,b... ✅ Succeeded 1m 10s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-09 12:09:26 UTC

@ggdaltoso
ggdaltoso merged commit 0874c72 into React95:master Nov 9, 2026
8 checks passed
@ggdaltoso

ggdaltoso commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Thanks, @Exalt24! Merged, the TitleBar title now follows headerText and headerNotActiveText. 🎉

@all-contributors please add @Exalt24 for code

@allcontributors

Copy link
Copy Markdown
Contributor

@ggdaltoso

I've put up a pull request to add @Exalt24! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TitleBar: the title ignores headerText and headerNotActiveText

2 participants