Repository navigation
feat: secondary accent for the sidebar captions - #73
Conversation
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.
Documentation build overview
5 files changed ·
|
|
@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? |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
flying-sheep
left a comment
There was a problem hiding this comment.
Makes sense to add secondary colors. But there’s already
--pst-color-link-hover(hovered and active links)--pst-color-link-higher-contrast(e.g. code links, check out e.g. https://scanpy.scverse.org/en/latest/api/index.html)
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.
|
also see scverse/scverse.github.io#368 but that doesn’t need to block this |
|
Let's get your PR in and then I'll revisit this one. Thanks for the feedback! |
|
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.
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. |
|
OK I don’t want the color conversion stuff, so I’m going to merge #74 first and then simplify this and merge it. |
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
left a comment
There was a problem hiding this comment.
looks great, but why not opt-out instead of opt-in?
* 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
Adds a
secondary_accenttheme option that colours the sidebar captions;Truetakes the package's second brand colour from the website, and nothing changes for packages that don't opt in.