Title Colors

14 views
Skip to first unread message

Paul Emigh

unread,
Dec 2, 2025, 4:52:40 PM (13 days ago) Dec 2
to PreTeXt development
I'm working on a custom theme based mostly on default-modern.  I'd like to change the title color (for the main title and the title of chapters, sections, subsections, and the titles of things like definitions).  There is a variable in color-vars ("body-title-color": #000,) that looks like it should control this, but I can't find any way to change it.

Andrew Scholer

unread,
Dec 2, 2025, 5:17:46 PM (13 days ago) Dec 2
to prete...@googlegroups.com
Paul - 

Your theme should probably have a line like:
@include colorHelpers.set-root-colors(...);

That renders a block of CSS that defines the variables used for colors.

You can override any of those variables by placing some CSS after that line that updates the variable(s) you care about. Something like:

:root:not(.dark-mode) {
    --body-title-color: #573c13;
}

Note that the variables created by the existing theme code defined in :root:not(.dark-mode), so you need to use a selector with equivalent or greater specificity for the block (not just :root).

Andrew Scholer

On Tue, Dec 2, 2025 at 1:52 PM Paul Emigh <paul....@gmail.com> wrote:
I'm working on a custom theme based mostly on default-modern.  I'd like to change the title color (for the main title and the title of chapters, sections, subsections, and the titles of things like definitions).  There is a variable in color-vars ("body-title-color": #000,) that looks like it should control this, but I can't find any way to change it.

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/b804abb1-1d23-447e-9998-ab2230798ce0n%40googlegroups.com.

Paul Emigh

unread,
Dec 4, 2025, 2:55:08 PM (11 days ago) Dec 4
to PreTeXt development
Do you have a sense for why something like the code below, which I've put at the bottom of my scss theme file, after the @include colorHelpers, doesn't seem to change the title inside the definition?  I've tried quite a few variants and nothing seems to get through to actually changing the title.  Below the code is a picture of the element (you can see that I was able to change the background color with no trouble via the mixin box).  (This is probably worth a different thread, but I cannot seem to figure out why the code keeps cutting off the left edge of the box either!)

.definition {
    --body-title-color: #D73F09;
}

Screenshot 2025-12-04 115347.png

Andrew Scholer

unread,
Dec 4, 2025, 3:45:01 PM (11 days ago) Dec 4
to prete...@googlegroups.com
The `--body-title-color` only gets applied to divisional titles. For blocks like <definition>, you probably want `--block-head-color`. But it is possible you have some other rule being applied and so that isn't the final value for `color` To give you a more concrete answer I would need a live sample.

As for the left cut off, there likely is a negative margin being applied somewhere. Again, without a live sample it is hard to say.

If you try to change the "box style" around something like a definition by overriding individual CSS rules, I would not be surprised if there are some rules that are leaking through. (The L-boxes involve some trickery that doesn't belong in a simple containing box.)

My recommendation to change the presentation style of a particular grouping element would be to make your own version of default-modern's _chunks-default.scss file. In it, remove .definition-like from the list of things that get an L-border. Line 38 in that file here:

And make a new rule for .definition-like that @includes the basic box rules. It should look like the .assemblage-like rule on line 24:
https://github.com/PreTeXtBook/pretext/blob/494e1120cb503dc980e9f28d6415025e6401a574/css/targets/html/default-modern/_chunks-default.scss#L24

That way you are starting that element from the "make a basic shareded box" CSS instead of the "make an L-box" CSS.

Reply all
Reply to author
Forward
0 new messages