Files
wekan/client/lib/activeTheme.js
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

19 lines
886 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { ReactiveCache } from '/imports/reactiveCache';
// The name of the theme the page is drawn in, in the order of themes of
// client/components/main/globalThemeColor.js: the member's own override, then the
// board's own colour on a board page, then the site theme. '' for WeKan's default.
// Reactive, so a Tracker.autorun that reads it follows a change of theme.
export function activeThemeName() {
const user = Meteor.user();
const own = user && user.profile && user.profile.globalThemeColor;
if (own) return own;
const boardId = Session.get('currentBoard');
const board = boardId ? ReactiveCache.getBoard(boardId) : null;
if (board && board.color) return board.color;
const setting = ReactiveCache.getCurrentSetting();
return (!board && setting && setting.themeColor) || '';
}