Files
wekan/client/components/main/uiFont.css
T
Lauri Ojansivu 8b2114cd0f Themes: every board theme and every color a member chooses is readable.
Eight themes (nephritis, pumpkin, moderatepink, strongcyan, limegreen, relax,
corteza, modern) had white text on an accent at 2.1 to 4.3:1: their accents and
hover, selected and emphasis shades are darkened until it reads at 4.5:1. The
filter sidebar's headings, the clear themes' quiet text and cleanlight's
add-dependency link are darker. A color a member chooses is made legible: a
custom theme accent or slide end is darkened under the header's white text, the
text color is moved to read on the theme's surfaces and no longer reaches the
header, labels and primary buttons, a dependency line is drawn at 3:1, Kanri's
tag text is the better of dark and light, and a custom label, card, list or
swimlane color already derives its text. All 25 themes show no colour contrast
failure on the board, the sidebars, Card Settings, the card and its popups.

Thanks to Samunosuke and xet7 !
2026-11-03 12:37:10 +02:00

87 lines
4.6 KiB
CSS

/* Member Settings / Font (#4759): apply the user's chosen UI font. The class lives
* on <body> and the --wekan-ui-font variable is set by uiFont.js only for a
* validated, whitelisted font. Form controls are listed explicitly because their
* UA default font-family does not inherit. Icon fonts (Font Awesome etc.) set their
* own font-family on the element, so they are unaffected. */
body.has-ui-font,
body.has-ui-font button,
body.has-ui-font input,
body.has-ui-font textarea,
body.has-ui-font select,
body.has-ui-font .wekan-form-control {
font-family: var(--wekan-ui-font) !important;
}
/* Font size preset (#4759): scale the root font size. Elements using relative units
* (em/rem/%) scale with it; the variable is a percentage set by uiFont.js only for a
* known preset. 'default'/unset removes it.
*
* #6587: this is on <html>, and it used to be on <body>. `rem` is measured against
* the ROOT element, so a size on body never reached it — and a board's type is
* written in rem (px would not follow this setting at all, and vw would change with
* the window), which is why minicards were the part of the UI that ignored the
* preset. Everything relative to body still scales, because body inherits from the
* root; putting the size on BOTH would compound the two. */
html.has-ui-font-size {
font-size: var(--wekan-ui-font-size) !important;
}
/* ...and that percentage is only half of it, because it can only reach text
* whose size is written in a RELATIVE unit. WeKan writes most of its sizes in
* px, and px is absolute: no root percentage moves it. So the setting scaled the
* minicards and the page headings - the parts written in rem - and left the
* header bar, the left menu, the lists and every popup exactly as they were.
* `html, body, input, select, textarea, button` even re-stated 14px, so the body
* took the stock size straight back off the scaled root.
*
* Every px `font-size` and `line-height` in the client stylesheets is therefore
* written
*
* font-size: calc(14px * var(--wekan-ui-font-scale, 1));
*
* and uiFont.js publishes the preset as that number. The fallback is 1 and the
* variable is REMOVED for 'default', so an instance where nobody touched the
* setting computes exactly the sizes it always did. line-height is scaled with
* the size on purpose: 21px of type in an 18px line box is the same setting
* half-applied. tests/uiFonts.test.cjs fails on any bare px text size, so a new
* one cannot quietly opt out of the setting. */
/* Text color (#4759): the variable is a validated hex set by uiFont.js.
*
* EVERY element, not just <body> and the form controls. Colour is inherited, so
* setting it on the body reached only text that had no colour of its own - and
* WeKan gives most of its text a colour of its own: the header bar's buttons,
* the left menu's rows, a minicard's title, a list header. Choosing green
* recoloured the page heading and the menu and left the rest exactly as it was,
* which is the same "half a setting" the size preset had.
*
* `.fa` is left out because it is not text: those elements are Font Awesome
* GLYPHS, drawn with `color` because that is how an icon font works. The ones
* that are meant to follow their label already say `color: inherit` and so
* follow this anyway; the ones with a colour of their own - a red alert, a
* green tick - keep saying what they mean. */
body.has-ui-text-color,
body.has-ui-text-color *:not(.fa):not(
#header, #header *,
#header-quick-access, #header-quick-access *,
.card-label, .card-label *,
button.primary, button.primary *
) {
color: var(--wekan-ui-text-color) !important;
}
/* The elements left out of the rule above sit on a COLOUR of their own - the
* theme's header bars, a label's colour, a primary button's accent - with a text
* colour that is chosen to read on it (4.5:1, WCAG 1.4.3). The member's colour is
* made legible on the page's surfaces (models/lib/uiFonts.js readableUiTextColor),
* which is not the same as legible on those: #626262 on the blue header was
* 1.18:1. */
/* There was a "text background color" here (#4759), a colour painted behind the
* text. It is REMOVED. A background needs elements to sit on, and neither choice
* of them looks right: on the boxes (its first form, `body`) it painted the whole
* window - the board canvas, the space under the lists - which is a page
* background and not a text one; on the elements that carry text it striped every
* heading, menu row and paragraph with a full-width band. A setting that cannot be
* made to look good is worse than no setting, so it is gone rather than tuned
* again. The text COLOUR above stays. */