Files
wekan/docs/Features/Theme/Change-Color.md
T
Lauri Ojansivu 7e1f9e89eb Docs: every feature topic in one folder under docs/Features, each with README.md as its main page.
- The General/ level is gone: its 109 files moved up into the folders of the
  same name, and its topic table is the "Shared topics" section of
  Features.md.
- Accessibility is one folder, docs/Features/Accessibility/, with the Admin
  Panel's accessibility page in it.
- Every folder's main page is README.md (110 X/X.md pages renamed with git mv,
  five merged with an existing README.md, 26 index pages added for folders
  that had none), so a folder opened on GitHub shows its page.
- The 73 "# Moved" forwarding pages are deleted, with the folders that held
  only them; every link that went to one goes to its final page.
- docs/Features/README.md has the website's "Features in WeKan" overview,
  each feature linking to its page here.

1,129 Markdown links in 262 files and 352 doc paths in code, tests, compose,
snap and release files follow. tests/docsFeaturesLayout.test.cjs fails when
General/ or a "# Moved" page comes back, a folder has no README.md, or a
relative link in the docs or README.md does not resolve.

Thanks to xet7 !
2026-11-24 20:02:06 +02:00

14 KiB
Raw Blame History

Design: Change color

What it is

Change color is the one picker WeKan uses everywhere a theme colour is chosen: for a board, for a member's own override, and for the whole site. It shows the themes grouped by category, a default row, the custom-colour wheels and a preview, and the same template draws it in all three places. This page also says which theme wins when several are set.

Read more

How to use it

  1. Open Change color in Board Settings (a board), Member Settings (yourself, everywhere) or Admin Panel / Settings / Appearance (the site).
  2. Click a theme swatch; it applies at once.
  3. For a flat or clear theme, choose a custom colour with the wheel(s).
  4. Choose the default row to remove that level's choice.

Which one you see: a board's own colour on the board page, unless you set your own colour in Member Settings; elsewhere your own colour, else the site theme, else WeKan's default (see "The order of themes" below).

How the numbers are calculated

  • The order is three layers, weakest first: 1 default, 2 site theme, 3 the user's own; a board's colour owns its board page.
  • Clear slides derive their palette from the base colour: the border under the bar is base × 0.8, the one above it base × 0.6, the current tab base × 1.15, and a selected minicard is the base mixed toward white. The six slides and their two ends are in the table below.

How it works in WeKan

One design, one implementation, for every place a theme colour is chosen: the swatches grouped by category, the "Default theme" row, the custom-colour wheels and the preview. One template renders all of them — the way Table is one table page for every table and Left Menu is one menu for every Admin Panel page.

A place that offers "Change color" does not write markup. It renders the shared template and says whose theme is being set:

+themeColorPicker(scope="board")    //- Board Settings / Change Color
+themeColorPicker(scope="global")   //- Member Settings / Change color
+themeColorPicker(scope="admin")    //- Admin Panel / Settings / Appearance / Change color

scope is the only difference between them.

File Path File Type Description
client/components/main/themeColorPicker.jade .jade template The picker: the "Default theme" row, the category groups of swatches, the custom-colour wheels and the preview.
client/components/main/themeColorPicker.js .js component Reads the current value for the scope, applies a click immediately, and writes it where that scope says.
models/lib/themeCategories.js .js module, pure helpers The categories, their order, which allow a custom colour and how many.
models/metadata/colors.js .js module BOARD_COLORS — the theme names themselves.
client/components/main/globalThemeColor.js .js startup Applies the winning theme to <body> and the CSS variables — the layering below.
client/components/sidebar/sidebar.jade .jade template Board Settings / Change Color — scope="board".
client/components/users/userHeader.jade .jade template Member Settings / Change color — scope="global".
client/components/settings/settingBody.jade .jade template Admin Panel / Settings / Appearance / Change color — scope="admin".
server/models/users.js .js methods setGlobalThemeColor — the user's own override.
server/methods/tenant.js .js methods getAdminThemeColor / setAdminThemeColor — the site theme, and which document it lands in.
models/lib/tenantAdmin.js .js module, pure helpers themeTarget() — the instance's theme, or one Organization's.
docs/Features/Theme/README.md .md guide What the themes look like, and the custom-colour categories.

The order of themes

Weakest first. Each layer replaces the one under it, and only where it is set:

Layer Set in Stored in
1 Default theme — nothing; WeKan's own stylesheet
2 Site theme Admin Panel / Settings / Appearance / Change color Settings.themeColor, or an Organization's orgThemeColor on its own hosts
3 User's own Member Settings / Change color user.profile.globalThemeColor

A board's own colour is not one of these layers: it is what a board looks like. It owns the board page, so the site theme is not applied there — but a user's own override is, because they asked for it everywhere.

Layer 2 is one setting with two possible homes, and the server picks the home (themeTarget() in models/lib/tenantAdmin.js):

  • the site admin sets the instance's theme — the one every Organization that has not chosen its own inherits, which is why their pane says so under the title;
  • an Organization's own admin sets that Organization's theme, which replaces the instance's on that Organization's hosts. It reaches nothing else.

The client never decides that. It calls getAdminThemeColor / setAdminThemeColor, and the server answers for whoever is asking — see Multitenancy (D.9) for how an Organization's value gets published in the instance's place.

Places that use this design

Place Scope Writes Clearing it means
Board Settings / Change Color board board.color + board.customThemeColors — (a board always has a colour, so there is no "Default theme" row)
Member Settings / Change color global setGlobalThemeColor fall back to the site theme, and to per-board colours
Admin Panel / Settings / Appearance / Change color admin setAdminThemeColor fall back to WeKan's default theme (or, for an Organization, to the instance's)

What the picker guarantees

  • No Save button anywhere. Clicking a swatch applies it immediately, and a custom-colour wheel applies on change (not on every intermediate value of a drag). The three places behave identically because it is the same code.

  • The same categories, in the same order, with the same labels (THEME_CATEGORY_ORDER), and the colour wheels appear only for the categories that take a custom colour — one for flat, two for clear (a gradient).

  • A "Default theme" row wherever there is something to fall back to, i.e. every scope except board. In the user's own scope a second switch sits beside it on the same row, All Boards, which paints the tiles of the All Boards overview in the theme's lighter colour (a white veil over --theme-accent) instead of each board's own colour, with white text on them. It is profile.allBoardsThemeTiles, off by default, flipped by toggleAllBoardsThemeTiles, and it reaches the page as has-theme-board-tiles on <body>. A board with a background image keeps its image.

    It answers #6593, which proposed making every tile white for everybody: the observation is right — a wall of boards in eleven colours reads as a palette rather than a list — but "the tile colours are noise" and "the tile colours are how I find my board" are both true, of different people, so it is a per-user switch and not a stylesheet.

    Only the global scope has it: a board has no overview of its own, and a site admin does not choose this for everybody.

  • The value is validated on the server. A theme name must be one of BOARD_COLORS and a custom colour must be a hex colour; anything else is refused rather than stored and rendered as a class.

Adding another place that chooses a theme

  1. Render +themeColorPicker(scope="…") — no markup of your own.
  2. Add the scope to SCOPES in themeColorPicker.js, with one branch in readCurrent() and one in applySelection().
  3. Say where it sits in the order of themes, in the table above.

If a new place needs a different-looking picker, change this template so every place gets it. That is the point of the design.

The theme is on the FIRST header bar

It used to be on the second, and most pages no longer render one — so #header-quick-access is the bar a reader actually sees painted. Three themes were wrong once it moved:

  • clearblue is a colour slide, and the slide was only ever on #header #header-main-bar, the inner element of the second bar. The first bar took the flat background-color: #00798d from the rule beside it — which is strongcyan's colour exactly, so choosing clearblue painted the header strongcyan. The slide is on #header-quick-access now.
  • natural and modern each had a later rule repainting the first bar the near-black shade it wore as a thin strip above the coloured main bar (#2d392b, #333 !important). Picking Natural painted the header near-black and Modern charcoal, whatever their own colours were. Both overrides are gone; the shared #header, #header-quick-access rule provides each theme's colour.

clearblue's text is full white too. Half-white was right when this bar was a secondary strip and its username and board links were background furniture; it is the header now, and no other theme dims them.

A slide is not a colour

Everything outside a board reads one variable, --theme-accent, and that is right for the eighteen flat themes. clearblue cannot be carried by it: a variable holds a colour, and a gradient is not one. So the rows that must slide are named in clearblue's own rule — the Admin Panel's selected left-menu row, which always was, and the All Boards one, which now is. Without that, All Boards' row sat flat #00798d beside an Admin Panel row that slid.

tests/themeAccents.test.cjs pins all of it: every theme paints the first bar, paints it its own colour, and no two themes paint it the same — which is how clearblue came to be indistinguishable from strongcyan.

One known exception, recorded rather than changed: cleanlight's accent is a mid-grey scraped from a #header ul li:hover rule, because it has no plain #header rule at all. Its bar is near-white, which cannot serve as an accent for white text, so the grey is right by accident. Choosing a deliberate accent for it is a maintainer's call about a colour, not a bug fix.

Six colour slides, not one

clearblue was the only theme in the clear category. Five more join it, each a slide from a light tint down to an existing flat theme's own colour, so the two categories cover the same colour families:

Theme Slide Base is
clearblue #499bea → #00798d (hand-tuned, the original)
cleargreen #8ad59f → #277c48 limegreen
clearorange #efab6f → #a75919 pumpkin
clearpink #df94b8 → #bd3a79 moderatepink
clearpurple #b685ca → #8e44ad wisteria
clearred #d67e75 → #c0392b pomegranate

The rest of each palette is arithmetic on the base, and it is clearblue's own arithmetic — its numbers turn out to be exact: the border under the bar is base × 0.8, the one above it base × 0.6, the current tab base × 1.15, a selected minicard the base mixed toward white. Deriving them means a seventh slide is one line rather than a page of guessed hexes, and it means no theme can be half-done.

Each block was generated from clearblue's, with one deliberate exception: its comments were dropped. They explain clearblue's own history — the flat bar that looked like strongcyan, the half-white username — and copied into a green theme those sentences are simply false. Each block carries a header saying what it is and what it was derived from instead.

Where they appear

Board Settings, Member Settings and Admin Panel / Settings / Appearance are one picker with a scope, and it groups by THEME_CATEGORIES. So a theme added to the category and to ALLOWED_BOARD_COLORS appears in all three at once, takes the category's two custom colours (a slide has two ends), and validates on the server through the same list. tests/themeAccents.test.cjs checks that wiring rather than trusting it.

It also checks that every theme in clear actually slides — a gradient, with two different ends, whose solid end is the accent everything outside a board reads. A slide theme with a flat bar is a flat theme filed in the wrong drawer, and that is not hypothetical: clearblue's own first bar was flat until it was fixed.

Button foregrounds

Ordinary filled buttons use the theme accent and white text. Clean Light's pale ordinary buttons use dark text; primary and destructive buttons retain their own paired foreground/background rules. The typography reset in layouts.css uses :where(...) for its neutral text color so it cannot overwrite a button's color when stylesheets load in a different order. Button typography still follows the member's font settings.

button-theme-foreground.e2e.js checks the Swimlane, List and Card settings buttons in normal, hover, focus and active states; chart-button-theme.e2e.js checks primary actions and custom theme colors on chart pages.

Commits