Alternative Themes

Dark Theme Light Theme
With the 3.0 update to Solaris, Solaris now has two theme variants. Depending on the preference you've set, Solaris will either appear in a dark theme or a light theme. This guide will go over how I did it.
 
If you'd like to see both themes, you can use the dark/light toggle buttons on the Labyrinthe Travelogue, or another prose article on this world.

 

How it's done


  The alternative themes are set up using a neat CSS feature called variables. Variables are custom properties. They are often used to create themes that are easy to change. When you use the variable var(--white) rather than the hex code #fff, you can change all the colours in one go by swapping out the value of the variable. Otherwise you'd have to replace each instance of the colour code.

 
This guide was written for the World Anvil community, where we have to set up our CSS in a way that doesn't affect the branding. If you're not writing CSS on World Anvil, you probably want to swap out any instance of .user-css-presentation for ::root.

 

Variable Palette

Solaris has two sets of variables. The first set define a palette of colours for me to use in my css. Even though the dark theme and the light theme are opposites, I also want them to have enough in common that they both feel like Solaris. Having the same layout goes a long way towards this. Using the same colours in different also brings continuity between the two themes.
 
Example Palette
 .user-css-presentation {
--black: #363636;
--grey: #e5e5e5;
--white: #fafafa;
--light: #f5f5f5;
--purple: #523462;
--pink: #be82be;
--blue: #00a2e8;
}

 

 

Variable Colour Scheme

The second set of variables define the colour scheme. This time I created variables for the background, border, text, and more. Rather than setting the background of the page to be a specific colour, I give it the variable var(--bg) (short for background). I'll use this variable anywhere I want to have the same colour as the background.
  I also set up an alternative background colour in var(--bgalt), which I use on elements that I want to stand out a bit on the page. In the light colour scheme, this is slightly darker than the background. On the dark colour scheme, it's a bit lighter. A lot of web designers like to make this alternative colour slightly transparent, so that it can be stacked on top of itself multiple times.
 

  Example Light Color Scheme
@media (prefers-color-scheme: light) {
 .user-css-presentation {
--bg: var(--white);
--bgalt: var(--light);
--border: var(--grey);
--accent: var(--blue);
--t: var(--black);
 }
}

 

  Example Dark Color Scheme
@media (prefers-color-scheme: dark) {
  .user-css-presentation {
 --bg: var(--black);
 --bgalt: #2f2346;
 --border: var(--purple);
 --accent: var(--pink);
 --t: var(--light);
  }
}

 
One of the colour schemes should be your default. The one you chose as your default shouldn't be inside of a media query (in other words, you want to remove the lines with orange text).

  As I went through my theme to decide what colours I needed, I added more variables to my colour scheme. I found I wanted a highlight colour, a second accent colour, and much more. The variables you'll need for your design will be different from mine, so you're going to want to set up your own variables as you discover your needs. Give them a name that explains the purpose, and you won't be confused when you return to update something a few months down the line.
 

 

Subscriber Group Themes

So you're not happy with simple media queries, and want to let people decide which theme they use. We can use subscriber groups to set this up. Using subscriber groups in this way wasn't my idea, it was something that my good friend Rin Garnett theorized as a potential use a while ago. For more interesting ways to use subscriber groups, check out their article Advanced Use of Subscriber Groups.
 

Detecting subscriber group

To set those subscriber groups to work, we're going to need a way to detect what, if any, subscriber group the person viewing the page has joined. There's no elegant solution for this, but we can place an exclusive subscriber group in a global field, and then set up our css code in a way that checks if that subscriber is present.
  1.First you're going to want to set up subscriber groups for each theme. I named mine Dark Theme and Light Theme. I gave them both the exclusive tag "theme" so that you could only have one theme group active, and I made sure that they were self-assignable.
  2.The next step is to set up the subscriber containers. Grab the subscriber container for your subscriber groups from the Access Rights Management page. In the subcontainer for your dark theme group, put the dark theme section, and vice versa for the light theme subscriber group container. I put these on my global world header block field. You can find it as one of the global content fields in the display options of your configuration settings. Make sure you do not use this class anywhere else, because if you do that page will have the associated theme.
 
Dark Theme
[subcontainer][section:active-dark] [/section][/subcontainer]
Light Theme
[subcontainer][section:active-light] [/section][/subcontainer]
Note: You can get the unique subcontainer bb code for the subscriber group you want to use by going to World Configuration > Subscribers & Authors > Subscriber Groups and clicking the second button labelled

  3. The last step is to write the actual code. Our goal is to make sure that a preferred theme will take priority over a browser preference, so we're going to nest our code inside of a media query for the opposite colour scheme preference. Then we use :has to see if the page has a specific class, and list out the preferred colour scheme. I also included .wob and .bow, the classes used by the prose page to swap between white text on a black background (wob) and black text on a white background (bow) while I was at it.
  If you aren't doing a browser-preference light and dark theme like I am, you don't need the first two lines with the media query and wob or bow.

  Overwrite Light Color Scheme
@media (prefers-color-scheme: light) {
 .user-css-presentation:has(.wob),
  .user-css-presentation:has(.active-dark) {
 --bg: var(--black);
 --bgalt: #2f2346;
 --border: var(--purple);
 --accent: var(--pink);
 --t: var(--light);
 }
}

 

  Overwrite Dark Scheme
@media (prefers-color-scheme: dark) {
  .user-css-presentation:has(.bow),
  .user-css-presentation:has(.active-light) {
  --bg: var(--white);
  --bgalt: var(--light);
  --border: var(--grey);
  --accent: var(--blue);
  --t: var(--black);
  }
}

 

 
Note: Because the creator of the world can see the content of all subscriber groups, you're now going to be permanently switched to whichever theme is last in your CSS. To test if your subscriber groups are set up correctly, ask a friend or use a test account.

 

Toggle Widget

If you want to add a toggle like the one in my sidebar, or at the top of the page, you're going to want to create your own widget. On the Access Rights Management page you can grab the self-assignable embed for any self-assignable group. You can swap out the text to say whatever you want, or even replace it with an icon using a section and font awesome code. (If you're adding an icon, remember to leave an empty space in the section.)
  You can put this self-assignable embed inside of a button, which you can also create with a section. You can make the default button of your world with [section:btn btn-primary] [/section]. Since the text itself is clickable, you could also use CSS to hide the checkbox like I did.
 

 

Tips and Tricks

  • You can also swap out the value in a variable at any point in your own css. For example, my navigation bar looks pretty much the same whether you're on the dark theme or the light theme. Since I always want the text in my navigation bar to be white, I decided to set the text variable in that area to be white too.
    • You can also use this to adapt for different screen sizes. We usually want less padding on mobile than we do on desktop, since space is at a premium on our phones. You can set up a variable for padding, and swap the values of that variable out in the media query for different sizes.
    • Keep in mind that If you do substitute a value later on, it means it won't be changed if you were to swap the value in the root.
  • You can add a fallback value by adding a second value inside of the variable. Using var(--bg, #f5f5f5) will make the website use #f5f5f5 when it can't figure out what --bg is for whatever reason. I use this to make sure the page will always have a background colour.

See Also

CSS CSS Repository · Styling Tooltips and Excerpts · Numbered Table of Content
Formatting Advanced Formatting with Containers
Other Resources
Notice: This article is a stub. It may be expanded later!

Comments

Please Login in order to comment!
Aug 26, 2025 15:24 by CoolG

Dark Solaris is beautiful!!! Though Light Solaris will always remain the MVP \o/

Explore the dark and mysterious Inferncenem, the bright and wonderful Caelumen, the dark but magical Ysteria, the vibrant and bustling Auxul or the world of contrasts Mytharae!   Have a good one!   WorldEmber 2025 is upon us! Check out my progress!
Aug 26, 2025 15:30 by Annie Stein

Thank you! I lean light too, but I have to admit dark theme is very nice when I'm rereading an article late at night

I'm a Comment Caroler! Click to learn more

Solaris -— a sapphic space opera
Creator of World of Worlds | Camp Chill | Comment Carolers

Aug 26, 2025 21:00 by Imagica

Dark Solaris is stunning!! I am a huge fan of this new theme <3 Such an elegant work Annie, congrats!

Worldember is finally here!! Here is my pledge!
I'm a Comment Caroler! Click to learn more
 
Come visit my world of Kena'an for tales of fantasy and magic! Or, if you fancy something darker, Crux Umbra awaits.
Aug 27, 2025 08:25 by Annie Stein

Thank you so much! I'm really glad people like it!

I'm a Comment Caroler! Click to learn more

Solaris -— a sapphic space opera
Creator of World of Worlds | Camp Chill | Comment Carolers

Sep 1, 2025 12:37 by Dr Emily Vair-Turnbull

Thanks for the tips, you always make them so easily digestible. <3

Emy x
Explore Etrea | WorldEmber 2025
Sep 1, 2025 16:53 by Annie Stein

Glad to hear it!

I'm a Comment Caroler! Click to learn more

Solaris -— a sapphic space opera
Creator of World of Worlds | Camp Chill | Comment Carolers

Sep 26, 2025 12:17

Thanks for sharing that - that's a great resource and deeply appreciated.

Join me at the sandy beaches of Aran'sha for new adventures.
Sep 26, 2025 15:09 by Annie Stein

I'm glad people appreciate it! Sharing knowledge is something I deeply value.

I'm a Comment Caroler! Click to learn more

Solaris -— a sapphic space opera
Creator of World of Worlds | Camp Chill | Comment Carolers