Skip to content

feat: secondary accent for the sidebar captions - #73

Merged
flying-sheep merged 7 commits into
mainfrom
secondary-accent
Oct 22, 2026
Merged

flying-sheep merged 7 commits into
mainfrom
secondary-accent

Conversation

@Zethson

@Zethson Zethson commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Adds a secondary_accent theme option that colours the sidebar captions; True takes the package's second brand colour from the website, and nothing changes for packages that don't opt in.

Packages with a two-tone logo, like pertpy, want their second colour on the sidebar captions.
The theme option secondary_accent sets it, defaulting to the package's second brand colour from the website, which scripts/sync_brand_tokens.py now writes to _secondary_accents.json.
Like the accent, only a shade readable on the light and dark backgrounds reaches the page; without one the captions keep the text colour.
pydata's --pst-color-secondary keeps following the accent, since it also colours link hovers, which should stay on the primary brand colour.
@read-the-docs-community

read-the-docs-community Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 scverse-doc | 🛠️ Build #35329207 | 📁 Comparing 99239cd against latest (c93914a)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

@Zethson

Zethson commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@flying-sheep a lot of our packages are dual colored (for now) so I think it'd be great to have native support for such colors in scverse-doc. This might change with our rebranding as I'm hoping to standardize colors a bit more but we gotta duke that out first 😄

OK with you to get this in?

@Zethson
Zethson requested a review from flying-sheep October 22, 2026 08:36
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a999c3c) to head (99239cd).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #73   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          609       622   +13     
=========================================
+ Hits           609       622   +13     
Files with missing lines Coverage Δ
src/scverse_doc/registry.py 100.00% <100.00%> (ø)
src/scverse_doc/theme/__init__.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@flying-sheep flying-sheep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to add secondary colors. But there’s already

Maybe we can use the secondary accent as one of these if it’s set? Otherwise there will be a bit too many colors IMHO. Just an idea.

@flying-sheep

Copy link
Copy Markdown
Member

also see scverse/scverse.github.io#368 but that doesn’t need to block this

@Zethson

Zethson commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Let's get your PR in and then I'll revisit this one. Thanks for the feedback!

@flying-sheep

flying-sheep commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

done!

we can keep cloning it for the bootstrap colors, but can now get the accent colors automatically as lists.

scverse/scverse.github.io#368 moved the package colours into assets/accents.json and generates the --<pkg>-<colour> properties from it in Sass, so main.scss no longer spells them out and the sync failed with --scverse-deep-blue and --scverse-sky-blue missing.
The script now reads accents.json, converts its OKLCH values to sRGB hex, takes each package's first colour as its accent and the second colour for the packages opted in to secondary accents, so far only pertpy.
The generated files are byte-identical except spatialdata, whose rounded OKLCH chroma of 0.2 lies outside sRGB and clips to #00a8ff instead of #40a9ff; 0.158 restores it, so that is fixed on the website rather than here.
@Zethson

Zethson commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Maybe we can use the secondary accent as one of these if it’s set? Otherwise there will be a bit too many colors IMHO. Just an idea.

Hmm these colors aren't quite doing what I'm doing with the secondary accent colors (e.g. headers). Nevertheless, you're correct. I'd like to merge it now as is and then follow up.

@flying-sheep

Copy link
Copy Markdown
Member

OK I don’t want the color conversion stuff, so I’m going to merge #74 first and then simplify this and merge it.

flying-sheep and others added 2 commits October 22, 2026 16:51
Which packages colour their sidebar captions is now each package's choice: secondary_accent = True takes its second brand colour from the registry instead of every package with a second colour getting coloured captions.

@flying-sheep flying-sheep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, but why not opt-out instead of opt-in?

@flying-sheep
flying-sheep merged commit 519e3a4 into main Oct 22, 2026
15 checks passed
@flying-sheep
flying-sheep deleted the secondary-accent branch October 22, 2026 15:27
Zethson added a commit to scverse/pertpy that referenced this pull request Oct 23, 2026
* Take the docs' accents from the scverse-doc registry and colour the sidebar captions red

scverse-doc's registry now carries pertpy's logo blue (scverse/scverse-doc#72), so the hard-coded accent is redundant, and secondary_accent = True takes pertpy's logo red for the sidebar captions (scverse/scverse-doc#73).
Both need the scverse-doc release after 0.2.4.

* Add changelog entry for #1182

* Require scverse-doc 0.3.0 for the secondary_accent theme option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants