Skip to content

Commit

Permalink
fix: use figma contrast colors (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored Jan 14, 2025
1 parent 88ca695 commit 38df038
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
11 changes: 6 additions & 5 deletions webapp/src/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import RighteousLatinWoff2 from './fonts/Righteous/righteous-latin.woff2';
import RubikWoff2 from './fonts/Rubik/Rubik-Regular.woff2';
import { colors } from './colors';
import { tolgeeColors, tolgeePalette } from 'figmaTheme';
import { fromFigmaColor } from 'tg.fixtures/figma';

const LOCALSTORAGE_THEME_MODE = 'themeMode';

Expand Down Expand Up @@ -124,13 +125,13 @@ const getTheme = (mode: PaletteMode) => {
},
palette: {
mode,
primary: tPalette.primary,
primary: fromFigmaColor(tPalette.primary),
primaryText: c.primaryText,
secondary: tPalette.secondary,
secondary: fromFigmaColor(tPalette.secondary),
default: createColor(c.default),
info: tPalette.info,
warning: tPalette.warning,
error: tPalette.error,
info: fromFigmaColor(tPalette.info),
warning: fromFigmaColor(tPalette.warning),
error: fromFigmaColor(tPalette.error),
common: {
white: c.white,
},
Expand Down
23 changes: 23 additions & 0 deletions webapp/src/fixtures/figma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { PaletteColorOptions } from '@mui/material';

type FigmaColor = {
main: string;
dark: string;
light: string;
contrast: string;
};

/**
* Transforms color from figma to mui theme format
*/
export const fromFigmaColor = ({
main,
dark,
light,
contrast,
}: FigmaColor): PaletteColorOptions => ({
main,
dark,
light,
contrastText: contrast,
});

0 comments on commit 38df038

Please sign in to comment.