Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(base/ui): update tokens (#15688)

Calinteodor5f44c7580d5e
diff --git a/react/features/base/ui/Tokens.ts b/react/features/base/ui/Tokens.ts
index e7a5890b59..bae41c62d8 100644
--- a/react/features/base/ui/Tokens.ts
+++ b/react/features/base/ui/Tokens.ts
@@ -1,49 +1,3 @@
-// Default color palette
-export const colors = {
- error03: '#7A141F',
- error04: '#A21B29',
- error05: '#CB2233',
- error06: '#D83848',
- error08: '#F24D5F',
-
- primary01: '#00112D',
- primary02: '#00225A',
- primary03: '#003486',
- primary04: '#0045B3',
- primary05: '#0056E0',
- primary06: '#246FE5',
- primary07: '#4687ED',
- primary08: '#99BBF3',
- primary09: '#CCDDF9',
-
- surface01: '#040404',
- surface02: '#141414',
- surface03: '#292929',
- surface04: '#3D3D3D',
- surface05: '#525252',
- surface06: '#666',
- surface07: '#858585',
- surface08: '#A3A3A3',
- surface09: '#C2C2C2',
- surface10: '#E0E0E0',
- surface11: '#FFF',
-
- success04: '#189B55',
- success05: '#1EC26A',
-
- warning05: '#F8AE1A',
- warning06: '#FFD600',
-
- support01: '#FF9B42',
- support02: '#F96E57',
- support03: '#DF486F',
- support04: '#B23683',
- support05: '#73348C',
- support06: '#6A50D3',
- support07: '#4380E2',
- support08: '#00A8B3',
- support09: '#2AA076'
-};
// Mapping between the token used and the color
export const colorMap = {
@@ -57,108 +11,110 @@ export const colorMap = {
// Container backgrounds
ui01: 'surface02',
ui02: 'surface03',
- ui03: 'surface04',
+ ui03: 'ui02',
ui04: 'surface05',
- ui05: 'surface06',
- ui06: 'surface07',
+ ui05: 'ui01',
+ ui06: 'ui03',
ui07: 'surface08',
- ui08: 'surface09',
- ui09: 'surface10',
- ui10: 'surface11',
+ ui08: 'ui21',
+ ui09: 'ui08',
+ ui10: 'ui04',
// ----- Actions -----
// Primary
- action01: 'primary06',
- action01Hover: 'primary07',
- action01Active: 'primary04',
+ action01: 'action01',
+ action01Hover: 'hover01',
+ action01Active: 'active01',
// Secondary
- action02: 'surface10',
- action02Hover: 'surface11',
- action02Active: 'surface09',
+ action02: 'action02',
+ action02Hover: 'hover02',
+ action02Active: 'active02',
// Destructive
- actionDanger: 'error05',
- actionDangerHover: 'error06',
- actionDangerActive: 'error04',
+ actionDanger: 'action03',
+ actionDangerHover: 'hover03',
+ actionDangerActive: 'active03',
// Tertiary
action03: 'transparent',
- action03Hover: 'surface04',
+ action03Hover: 'hover05',
action03Active: 'surface03',
// Disabled
- disabled01: 'surface09',
+ disabled01: 'disabled01',
// Focus
- focus01: 'primary07',
+ focus01: 'focus01',
// ----- Links -----
- link01: 'primary07',
- link01Hover: 'primary08',
- link01Active: 'primary06',
+ link01: 'action01',
+ link01Hover: 'hover07',
+ link01Active: 'action04',
// ----- Text -----
// Primary
- text01: 'surface11',
+ text01: 'textColor01',
// Secondary
- text02: 'surface09',
+ text02: 'textColor02',
// Tertiary
- text03: 'surface07',
+ text03: 'ui03',
// High-contrast
text04: 'surface01',
// Error
- textError: 'error08',
+ textError: 'alertRed',
// ----- Icons -----
// Primary
- icon01: 'surface11',
+ icon01: 'icon01',
// Secondary
- icon02: 'surface09',
+ icon02: 'ui21',
// Tertiary
- icon03: 'surface07',
+ icon03: 'icon07',
// High-contrast
icon04: 'surface01',
// Error
- iconError: 'error06',
+ iconError: 'action03',
+
+ // Normal
+ iconNormal: 'action04',
+
+ // Success
+ iconSuccess: 'alertGreen',
+
+ // Warning
+ iconWarning: 'warning01',
// ----- Forms -----
- field01: 'surface04',
+ field01: 'ui02',
// ----- Feedback -----
// Success
success01: 'success05',
- success02: 'success04',
+ success02: 'success01',
// Warning
- warning01: 'warning05',
+ warning01: 'warning01',
warning02: 'warning06',
// ----- Support -----
- support01: 'support01',
- support02: 'support02',
- support03: 'support03',
- support04: 'support04',
support05: 'support05',
- support06: 'support06',
- support07: 'support07',
- support08: 'support08',
- support09: 'support09'
+ support06: 'support06'
};
@@ -177,19 +133,9 @@ export const spacing
= [ 0, 4, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128 ];
export const typography = {
- labelRegular: {
- fontSize: 12,
- lineHeight: 16,
- fontWeight: font.weightRegular,
- letterSpacing: 0.16
- },
+ labelRegular: 'label01',
- labelBold: {
- fontSize: 12,
- lineHeight: 16,
- fontWeight: font.weightSemiBold,
- letterSpacing: 0.16
- },
+ labelBold: 'labelBold01',
bodyShortRegularSmall: {
fontSize: 10,
@@ -254,19 +200,9 @@ export const typography = {
letterSpacing: 0
},
- heading1: {
- fontSize: 54,
- lineHeight: 64,
- fontWeight: font.weightSemiBold,
- letterSpacing: 0
- },
+ heading1: 'heading01',
- heading2: {
- fontSize: 42,
- lineHeight: 50,
- fontWeight: font.weightSemiBold,
- letterSpacing: 0
- },
+ heading2: 'heading02',
heading3: {
fontSize: 32,
diff --git a/react/features/base/ui/components/BaseTheme.native.ts b/react/features/base/ui/components/BaseTheme.native.ts
index 702c221328..972fae7b92 100644
--- a/react/features/base/ui/components/BaseTheme.native.ts
+++ b/react/features/base/ui/components/BaseTheme.native.ts
@@ -1,11 +1,10 @@
-import { colorMap, colors, font, shape, spacing, typography } from '../Tokens';
+import { colorMap, font, shape, spacing, typography } from '../Tokens';
import { createNativeTheme } from '../functions.native';
import updateTheme from './updateTheme.native';
export default createNativeTheme(updateTheme({
font,
- colors,
colorMap,
spacing,
shape,
diff --git a/react/features/base/ui/components/BaseTheme.web.ts b/react/features/base/ui/components/BaseTheme.web.ts
index b83b77d593..0d44956c76 100644
--- a/react/features/base/ui/components/BaseTheme.web.ts
+++ b/react/features/base/ui/components/BaseTheme.web.ts
@@ -1,9 +1,8 @@
-import { breakpoints, colorMap, colors, font, shape, spacing, typography } from '../Tokens';
+import { breakpoints, colorMap, font, shape, spacing, typography } from '../Tokens';
import { createWebTheme } from '../functions.web';
export default createWebTheme({
font,
- colors,
colorMap,
spacing,
shape,
diff --git a/react/features/base/ui/functions.native.ts b/react/features/base/ui/functions.native.ts
index 6c3ab9950e..602f4b0a3e 100644
--- a/react/features/base/ui/functions.native.ts
+++ b/react/features/base/ui/functions.native.ts
@@ -8,10 +8,10 @@ import { createColorTokens } from './utils';
* @param {Object} arg - The ui tokens.
* @returns {Object}
*/
-export function createNativeTheme({ font, colors, colorMap, shape, spacing, typography }: any): any {
+export function createNativeTheme({ font, colorMap, shape, spacing, typography }: any): any {
return {
...DefaultTheme,
- palette: createColorTokens(colorMap, colors),
+ palette: createColorTokens(colorMap),
shape,
spacing,
typography: {
diff --git a/react/features/base/ui/functions.web.ts b/react/features/base/ui/functions.web.ts
index e3e4cf952a..01774a7412 100644
--- a/react/features/base/ui/functions.web.ts
+++ b/react/features/base/ui/functions.web.ts
@@ -16,7 +16,6 @@ declare module '@mui/material/styles' {
interface ThemeProps {
breakpoints: Object;
colorMap: Object;
- colors: Object;
font: Object;
shape: Object;
spacing: Array<number>;
@@ -29,10 +28,10 @@ interface ThemeProps {
* @param {Object} arg - The ui tokens.
* @returns {Object}
*/
-export function createWebTheme({ font, colors, colorMap, shape, spacing, typography, breakpoints }: ThemeProps) {
+export function createWebTheme({ font, colorMap, shape, spacing, typography, breakpoints }: ThemeProps) {
return createTheme(adaptV4Theme({
spacing,
- palette: createColorTokens(colorMap, colors),
+ palette: createColorTokens(colorMap),
shape,
typography: {
// @ts-ignore
diff --git a/react/features/base/ui/jitsiTokens.json b/react/features/base/ui/jitsiTokens.json
new file mode 100644
index 0000000000..54bf1d84c3
--- /dev/null
+++ b/react/features/base/ui/jitsiTokens.json
@@ -0,0 +1,14 @@
+{
+ "success05": "#1EC26A",
+
+ "support05": "#73348C",
+ "support06": "#6A50D3",
+
+ "surface01": "#040404",
+ "surface02": "#141414",
+ "surface03": "#292929",
+ "surface05": "#525252",
+ "surface08": "#A3A3A3",
+
+ "warning06": "#FFD600"
+}
diff --git a/react/features/base/ui/tokens.json b/react/features/base/ui/tokens.json
new file mode 100644
index 0000000000..7139d9d4c8
--- /dev/null
+++ b/react/features/base/ui/tokens.json
@@ -0,0 +1,211 @@
+{
+ "action01": "#4687ED",
+ "action02": "#E0E0E0",
+ "action03": "#D83848",
+ "action04": "#246FE5",
+ "action05": "#4687ED",
+ "action06": "#0056E0",
+ "action07": "#D7E3F9",
+ "action08": "#99BBF3",
+ "action09": "#4687ED",
+
+ "active01": "#0056E0",
+ "active02": "#C2C2C2",
+ "active03": "#CB2233",
+ "active04": "#189B55",
+ "active05": "#666666",
+ "active07": "#0056E0",
+ "active08": "#525252",
+ "active09": "#3D3D3D",
+ "active10": "#3D3D3D",
+ "active11": "#CCDDF9",
+ "active12": "#666666",
+
+ "alertGreen": "#189B55",
+ "alertRed": "#F24D5F",
+ "alertYellow": "#F8AE1A",
+
+ "body01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "0.875rem",
+ "lineHeight": "1.25rem",
+ "fontWeight": 400,
+ "letterSpacing": "-0.006rem"
+ },
+ "body02": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "1rem",
+ "lineHeight": "1.5rem",
+ "fontWeight": 400,
+ "letterSpacing": "-0.011rem"
+ },
+ "bodyBold01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "0.875rem",
+ "lineHeight": "1.25rem",
+ "fontWeight": 600,
+ "letterSpacing": "-0.006rem"
+ },
+ "bodyBold02": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "1rem",
+ "lineHeight": "1.5rem",
+ "fontWeight": 600,
+ "letterSpacing": "-0.011rem"
+ },
+
+ "brand01": "#FFFFFF",
+
+ "bulletList01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "0.875rem",
+ "lineHeight": "1.5rem",
+ "fontWeight": 400,
+ "letterSpacing": "-0.006rem"
+ },
+
+ "data01": "#C15C97",
+ "data02": "#4079D3",
+ "data03": "#A276B2",
+ "data04": "#4CAC9C",
+ "data05": "#E76782",
+ "data06": "#8CA7D1",
+ "data07": "#B23683",
+ "data08": "#FFA95E",
+ "data09": "#8B559F",
+ "data10": "#009B89",
+ "data11": "#858585",
+
+ "dataText01": "#292929",
+ "dataText02": "#292929",
+ "dataText03": "#292929",
+ "dataText04": "#000000",
+ "dataText05": "#000000",
+ "dataText06": "#000000",
+ "dataText07": "#FFFFFF",
+ "dataText08": "#000000",
+ "dataText09": "#FFFFFF",
+ "dataText10": "#FFFFFF",
+ "dataText11": "#000000",
+
+ "disabled01": "#C2C2C2",
+ "disabled02": "#666666",
+ "disabled03": "#C2C2C2",
+ "disabled04": "#858585",
+
+ "error01": "#F24D5F",
+
+ "focus01": "#D7E3F9",
+
+ "heading01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "1.25rem",
+ "lineHeight": "1.75rem",
+ "fontWeight": 600,
+ "letterSpacing": "-0.017rem"
+ },
+ "heading02": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "1.75rem",
+ "lineHeight": "2.5rem",
+ "fontWeight": 600,
+ "letterSpacing": "-0.020rem"
+ },
+
+ "highlight01": "#F8AE1A",
+
+ "hover01": "#4687ED",
+ "hover02": "#F1F1F1",
+ "hover03": "#F24D5F",
+ "hover04": "#4BCE88",
+ "hover05": "#3D3D3D",
+ "hover06": "#666666",
+ "hover07": "#99BBF3",
+ "hover08": "#2F2E32",
+ "hover09": "#666666",
+ "hover10": "#292929",
+ "hover11": "#99BBF3",
+ "hover12": "#3D3D3D",
+ "hover13": "#525252",
+
+ "icon01": "#FFFFFF",
+ "icon02": "#FFFFFF",
+ "icon03": "#666666",
+ "icon04": "#0056E0",
+ "icon05": "#292929",
+ "icon06": "#666666",
+ "icon07": "#858585",
+ "icon08": "#292929",
+
+ "info01": "#666666",
+
+ "label01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "0.75rem",
+ "lineHeight": "1rem",
+ "fontWeight": 400,
+ "letterSpacing": "normal"
+ },
+ "labelBold01": {
+ "fontFamily": "Inter, sans-serif",
+ "fontSize": "0.75rem",
+ "lineHeight": "1rem",
+ "fontWeight": 600,
+ "letterSpacing": "normal"
+ },
+
+ "overlay01": "#292929BF",
+
+ "shadow01": "#141414",
+ "shadowHigh": "0px 2px 20px 9px #141414",
+ "shadowLow": "0px 1px 2px 1px #141414",
+ "shadowMedium": "0px 2px 8px 2px #141414",
+
+ "statusAvailable01": "#189B55",
+ "statusAway01": "#DD7011",
+ "statusBusy01": "#F24D5F",
+ "statusOffline01": "#666666",
+ "statusWrapup01": "#8B559F",
+
+ "success01": "#189B55",
+
+ "textColor01": "#FFFFFF",
+ "textColor02": "#C2C2C2",
+ "textColor04": "#292929",
+ "textColor05": "#C2C2C2",
+ "textColor06": "#FFFFFF",
+ "textColor07": "#292929",
+ "textColor08": "#FFFFFF",
+ "textColor09": "#000000",
+ "textColor10": "#E7E3FF",
+
+ "ui01": "#666666",
+ "ui02": "#3D3D3D",
+ "ui03": "#858585",
+ "ui04": "#FFFFFF",
+ "ui05": "#2F2E32",
+ "ui06": "#171719",
+ "ui07": "#F1F1F1",
+ "ui08": "#E0E0E0",
+ "ui09": "#CCDDF9",
+ "ui10": "#666666",
+ "ui11": "#0C0C0D",
+ "ui12": "#212124",
+ "ui13": "#003486",
+ "ui14": "#127440",
+ "ui15": "#00225A",
+ "ui16": "#F5D3D6",
+ "ui17": "#FEEFD1",
+ "ui18": "#D2F3E1",
+ "ui19": "#E0E0E0",
+ "ui20": "#E8DCEC",
+ "ui21": "#C2C2C2",
+ "ui22": "#CCDDF9",
+ "ui23": "#3C2F8E",
+ "ui24": "#5F50BE",
+ "ui25": "#171719",
+
+ "warning01": "#F8AE1A",
+ "warning02": "#F8AE1A",
+ "warning03": "#9F701C"
+}
\ No newline at end of file
diff --git a/react/features/base/ui/utils.ts b/react/features/base/ui/utils.ts
index e474d702ba..a0fa4ef399 100644
--- a/react/features/base/ui/utils.ts
+++ b/react/features/base/ui/utils.ts
@@ -1,13 +1,21 @@
+import { merge } from 'lodash';
+
+import * as jitsiTokens from './jitsiTokens.json';
+import * as tokens from './tokens.json';
+
/**
* Creates the color tokens based on the color theme and the association map.
- * If a key is not found in the association map it defaults to the current value.
*
* @param {Object} colorMap - A map between the token name and the actual color value.
- * @param {Object} colors - An object containing all the theme colors.
* @returns {Object}
*/
-export function createColorTokens(colorMap: Object, colors: Object): any {
+export function createColorTokens(colorMap: Object): any {
+ const allTokens = merge({}, tokens, jitsiTokens);
+
return Object.entries(colorMap)
- .reduce((result, [ token, value ]: [any, keyof Object]) =>
- Object.assign(result, { [token]: colors[value] || value }), {});
+ .reduce((result, [ token, value ]: [any, string]) => {
+ const color = allTokens[value as keyof typeof allTokens];
+
+ return Object.assign(result, { [token]: color });
+ }, {});
}
diff --git a/react/features/dynamic-branding/functions.web.ts b/react/features/dynamic-branding/functions.web.ts
index 0701d09121..d40c2c6a4d 100644
--- a/react/features/dynamic-branding/functions.web.ts
+++ b/react/features/dynamic-branding/functions.web.ts
@@ -1,7 +1,7 @@
import { Theme } from '@mui/material';
import { adaptV4Theme, createTheme } from '@mui/material/styles';
-import { breakpoints, colorMap, colors, font, shape, spacing, typography } from '../base/ui/Tokens';
+import { breakpoints, colorMap, font, shape, spacing, typography } from '../base/ui/Tokens';
import { createColorTokens } from '../base/ui/utils';
/**
@@ -19,7 +19,7 @@ export function createMuiBrandingTheme(customTheme: Theme) {
spacing: customSpacing
} = customTheme;
- const newPalette = createColorTokens(colorMap, colors);
+ const newPalette = createColorTokens(colorMap);
if (customPalette) {
overwriteRecurrsive(newPalette, customPalette);
diff --git a/react/features/notifications/components/native/Notification.tsx b/react/features/notifications/components/native/Notification.tsx
index 5aae11b278..028f6529db 100644
--- a/react/features/notifications/components/native/Notification.tsx
+++ b/react/features/notifications/components/native/Notification.tsx
@@ -9,7 +9,6 @@ import {
IconUsers,
IconWarning
} from '../../../base/icons/svg';
-import { colors } from '../../../base/ui/Tokens';
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
import Button from '../../../base/ui/components/native/Button';
import IconButton from '../../../base/ui/components/native/IconButton';
@@ -30,10 +29,10 @@ import styles from './styles';
*/
const ICON_COLOR = {
- error: colors.error06,
- normal: colors.primary06,
- success: colors.success05,
- warning: colors.warning05
+ error: BaseTheme.palette.iconError,
+ normal: BaseTheme.palette.iconNormal,
+ success: BaseTheme.palette.iconSuccess,
+ warning: BaseTheme.palette.iconWarning
};