From 2dd80e2c013991fba693a4189ca4321a91704cc1 Mon Sep 17 00:00:00 2001 From: "Lukas.J.Han" Date: Sun, 16 Mar 2025 11:04:24 +0900 Subject: [PATCH 1/3] wip: setup structure Signed-off-by: Lukas.J.Han --- packages/core/lib/provider.tsx | 65 +++++ packages/tailwindcss-plugin/krds-plugin.js | 285 --------------------- 2 files changed, 65 insertions(+), 285 deletions(-) create mode 100644 packages/core/lib/provider.tsx diff --git a/packages/core/lib/provider.tsx b/packages/core/lib/provider.tsx new file mode 100644 index 0000000..5e6db8f --- /dev/null +++ b/packages/core/lib/provider.tsx @@ -0,0 +1,65 @@ +import React, { useState } from 'react'; + +export type ThemeMode = 'light' | 'dark' | 'high-contrast' | 'system'; + +export type PrimitiveToken = {}; + +export type SemanticToken = {}; + +export type ComponentToken = {}; + +export type Locale = 'ko' | 'en'; + +export type TextSize = 'small' | 'medium' | 'large'; + +export type DesignToken = { + primitive: PrimitiveToken; + semantic: SemanticToken; + component: ComponentToken; +}; + +export type DesignTokenProps = { + primitive?: Partial; + semantic?: Partial; + component?: Partial; +}; + +export type ContextProps = { + token: DesignToken; + mode: ThemeMode; + locale: Locale; + textSize: TextSize; + + setThemeMode: (mode: ThemeMode) => void; + setLocale: (locale: Locale) => void; + setTextSize: (textSize: TextSize) => void; +}; + +export const Context = React.createContext({} as ContextProps); + +export const ContextProvider: React.FC<{ + token: DesignTokenProps; + children: React.ReactNode; +}> = ({ token, children }) => { + const [themeMode, setThemeMode] = useState('system'); + const [locale, setLocale] = useState('ko'); + const [textSize, setTextSize] = useState('medium'); + + const context: ContextProps = { + token: { ...token }, + mode: themeMode, + locale: locale, + textSize: textSize, + setThemeMode: (mode) => setThemeMode(mode), + setLocale: (locale) => setLocale(locale), + setTextSize: (textSize) => setTextSize(textSize), + }; + + return {children}; +}; + +export const useContext = () => { + return React.useContext(Context); +}; + +export default ContextProvider; diff --git a/packages/tailwindcss-plugin/krds-plugin.js b/packages/tailwindcss-plugin/krds-plugin.js index 782df9b..056ec22 100644 --- a/packages/tailwindcss-plugin/krds-plugin.js +++ b/packages/tailwindcss-plugin/krds-plugin.js @@ -5,7 +5,6 @@ module.exports = plugin( { theme: { screens: { - // If you need more info about this, check https://uiux.egovframe.go.kr/guide/style/style_05.html // ~600px: mobile mobile: '360px', // 601px ~ 1024px: tablet @@ -126,290 +125,6 @@ module.exports = plugin( 80: '#0C1F4D', 90: '#040A1A', }, - navy: { - 5: '#F1F1F9', - 10: '#D3D5ED', - 20: '#A7AEDA', - 30: '#7B82C8', - 40: '#4F57B5', - 50: '#232EA3', - 60: '#1C25B2', - 70: '#151C62', - 80: '#0E1241', - 90: '#070921', - }, - blue: { - 5: '#F0F3FF', - 10: '#D2DCFE', - 20: '#A4B8FE', - 30: '#7795FD', - 40: '#4A71FC', - 50: '#1C4EFC', - 60: '#163ECA', - 70: '#112F97', - 80: '#0B1F65', - 90: '#061032', - }, - 'royal-blue': { - 5: '#EBF5FF', - 10: '#C7E3FF', - 20: '#8FC8FF', - 30: '#56ACFF', - 40: '#0D76AE', - 50: '#0D76AE', - 60: '#0A5AA6', - 70: '#04407F', - 80: '#002B55', - 90: '#00152A', - }, - 'sky-blue': { - 5: '#F0F8FF', - 10: '#D4F3FE', - 20: '#A9E6FC', - 30: '#7DDAFB', - 40: '#52CDFA', - 50: '#27C1F8', - 60: '#1F9AC6', - 70: '#177495', - 80: '#0F4D63', - 90: '#082732', - }, - aqua: { - 5: '#E7FDFD', - 10: '#CEFBFB', - 20: '#9CF6F6', - 30: '#6BF2F2', - 40: '#39EDED', - 50: '#08E8E8', - 60: '#06BABA', - 70: '#058C8C', - 80: '#035D5D', - 90: '#022F2F', - }, - teal: { - 5: '#EDF8F8', - 10: '#CEEEED', - 20: '#9DD7D7', - 30: '#6DC3C3', - 40: '#3CAEAE', - 50: '#0B9B98', - 60: '#097C7C', - 70: '#075D5D', - 80: '#043E3E', - 90: '#021F1F', - }, - green: { - 5: '#EEF7EE', - 10: '#CCE6CC', - 20: '#99CC99', - 30: '#66B366', - 40: '#339933', - 50: '#008000', - 60: '#006600', - 70: '#004D00', - 80: '#003300', - 90: '#001A00', - }, - 'lime-green': { - 5: '#F3FCF3', - 10: '#D6F5D6', - 20: '#ADEBAD', - 30: '#84E184', - 40: '#5BD75B', - 50: '#32CD32', - 60: '#28A428', - 70: '#1E7B1E', - 80: '#145214', - 90: '#0A290A', - }, - lime: { - 5: '#F7FFEA', - 10: '#EEFEDA', - 20: '#DCFFAB', - 30: '#CEFE83', - 40: '#BCF95D', - 50: '#A1F524', - 60: '#8BD013', - 70: '#6A9B16', - 80: '#476912', - 90: '#23570D', - }, - olive: { - 5: '#F8F8ED', - 10: '#EBEBCC', - 20: '#D6D699', - 30: '#C2C266', - 40: '#ADAD33', - 50: '#999900', - 60: '#7A7A00', - 70: '#5C5C00', - 80: '#3D3D00', - 90: '#1F1F00', - }, - yellow: { - 5: '#FFFBE5', - 10: '#FFF4CC', - 20: '#FFEE99', - 30: '#FFE566', - 40: '#FFD033', - 50: '#FFD400', - 60: '#CCA300', - 70: '#A38200', - 80: '#665200', - 90: '#332900', - }, - gold: { - 5: '#FDF7E9', - 10: '#FAEFD3', - 20: '#F5DFA7', - 30: '#F1CF7A', - 40: '#ECBF4E', - 50: '#E7AF22', - 60: '#B98C1B', - 70: '#8B6915', - 80: '#5C460E', - 90: '#2E2307', - }, - 'saddle-brown': { - 5: '#F8F2ED', - 10: '#ECDCCD', - 20: '#D9B99C', - 30: '#C6966A', - 40: '#B37439', - 50: '#A05107', - 60: '#804106', - 70: '#603104', - 80: '#402003', - 90: '#201001', - }, - brown: { - 5: '#F9F2F0', - 10: '#EED8D3', - 20: '#DCB0A7', - 30: '#CB897C', - 40: '#B96150', - 50: '#A83A24', - 60: '#862E1D', - 70: '#652316', - 80: '#43170E', - 90: '#220C07', - }, - 'dark-red': { - 5: '#FAEFF0', - 10: '#F1CED0', - 20: '#E39D9F', - 30: '#D56C6F', - 40: '#C73A3F', - 50: '#B9090F', - 60: '#94070C', - 70: '#6F0509', - 80: '#4A0306', - 90: '#250203', - }, - red: { - 5: '#FEF1F1', - 10: '#FCCBCC', - 20: '#F99999', - 30: '#F56666', - 40: '#F23B3B', - 50: '#EE0000', - 60: '#BE0000', - 70: '#8F0000', - 80: '#5F0000', - 90: '#300000', - }, - orange: { - 5: '#FFF4F0', - 10: '#FFD4CC', - 20: '#FFB899', - 30: '#FF9C66', - 40: '#FF8033', - 50: '#FF6400', - 60: '#CC5000', - 70: '#993C00', - 80: '#662800', - 90: '#331400', - }, - coral: { - 5: '#FFF8F5', - 10: '#FFE6DC', - 20: '#FFCDB8', - 30: '#FFB495', - 40: '#FF9B71', - 50: '#FE8052', - 60: '#CB6642', - 70: '#984D31', - 80: '#663321', - 90: '#331A10', - }, - salmon: { - 5: '#FFF1F0', - 10: '#FFE3E0', - 20: '#FFCBC1', - 30: '#FEACA3', - 40: '#FE9184', - 50: '#FD7565', - 60: '#CA5E51', - 70: '#97463D', - 80: '#652F28', - 90: '#321714', - }, - 'hot-pink': { - 5: '#FFF5FC', - 10: '#FFE3F5', - 20: '#FFC4EC', - 30: '#FFAAE2', - 40: '#FF8DD9', - 50: '#FF6FCE', - 60: '#CC59A5', - 70: '#99437C', - 80: '#662C53', - 90: '#331629', - }, - pink: { - 5: '#FFF0F8', - 10: '#FFD0E9', - 20: '#FFA1D4', - 30: '#FF72BE', - 40: '#FF43A9', - 50: '#FF1493', - 60: '#CC1076', - 70: '#990C58', - 80: '#66083B', - 90: '#33041D', - }, - fuchsia: { - 5: '#FDF2FD', - 10: '#F901F9', - 20: '#F2A3F2', - 30: '#EC75EC', - 40: '#E547E5', - 50: '#DF19DF', - }, - purple: { - 5: '#F5EEF7', - 10: '#E1CCE6', - 20: '#C499CC', - 30: '#A666B3', - 40: '#893399', - 50: '#600080', - 60: '#4D0066', - 70: '#3A004D', - 80: '#260033', - 90: '#13001A', - }, - 'blue-violet': { - 5: '#F4EFFA', - 10: '#DED1F1', - 20: '#BDA2E3', - 30: '#9B74D4', - 40: '#7A45C6', - 50: '#5917B8', - 60: '#471293', - 70: '#350E6E', - 80: '#24094A', - 90: '#120525', - }, }, fontSize: { 'display-l': ['66px', { lineHeight: '150%', letterSpacing: '1px' }], From 25779eacbedc3db6e5cb7817ed60bd0547a64948 Mon Sep 17 00:00:00 2001 From: "Lukas.J.Han" Date: Sun, 16 Mar 2025 15:16:17 +0900 Subject: [PATCH 2/3] feat: apply color 1.0 Signed-off-by: Lukas.J.Han --- packages/core/lib/colors/color.ts | 802 ++++++++++++--------- packages/core/lib/colors/color.type.ts | 223 ------ packages/core/lib/components/Body.tsx | 5 +- packages/core/lib/components/Detail.tsx | 5 +- packages/core/lib/components/Display.tsx | 5 +- packages/core/lib/components/Heading.tsx | 5 +- packages/core/lib/components/Label.tsx | 6 +- packages/core/lib/components/Link.tsx | 6 +- packages/core/lib/components/Spinner.tsx | 11 +- packages/core/lib/components/Title.tsx | 5 +- packages/core/lib/provider.tsx | 30 +- packages/tailwindcss-plugin/krds-plugin.js | 520 ++++++------- stories/core/color.stories.tsx | 648 ++++++----------- 13 files changed, 981 insertions(+), 1290 deletions(-) delete mode 100644 packages/core/lib/colors/color.type.ts diff --git a/packages/core/lib/colors/color.ts b/packages/core/lib/colors/color.ts index f173b65..2eaec57 100644 --- a/packages/core/lib/colors/color.ts +++ b/packages/core/lib/colors/color.ts @@ -1,368 +1,464 @@ -export const colors = { - primary: '#246BEB', - primary0: '#FFFFFF', - primary5: '#EFF5FF', - primary10: '#D3E1FB', - primary20: '#A7C4F7', - primary30: '#7CA6F3', - primary40: '#5089EF', - primary50: '#246BEB', - primary60: '#1D56BC', - primary70: '#16408D', - primary80: '#0E2B5E', - primary90: '#07152F', - primary100: '#000000', - - secondary: '#003675', - secondary0: '#FFFFFF', - secondary5: '#EDF1F5', - secondary10: '#CDD7E4', - secondary20: '#B4C4D6', - secondary30: '#99B0CB', - secondary40: '#2A5C96', - secondary50: '#003675', - secondary60: '#002B5E', - secondary70: '#002046', - secondary80: '#00162F', - secondary90: '#000B17', - secondary100: '#000000', - - gray0: '#FFFFFF', - gray5: '#F8F8F8', - gray10: '#F0F0F0', - gray20: '#E4E4E4', - gray30: '#D8D8D8', - gray40: '#C6C6C6', - gray50: '#8E8E8E', - gray60: '#717171', - gray70: '#555555', - gray80: '#2D2D2D', - gray90: '#1D1D1D', - gray100: '#000000', - - point: '#E71825', - point0: '#FFFFFF', - point5: '#FDF2F3', - point10: '#FBD6D8', - point20: '#F5A3A8', - point30: '#F1747C', - point40: '#EC4651', - point50: '#E71825', - point60: '#B9131E', - point70: '#8B0E16', - point80: '#5C0A0F', - point90: '#2E0507', - point100: '#000000', - - danger: '#EB003B', - danger5: '#FEECF0', - danger10: '#FCD4DE', - danger20: '#F799B1', - danger30: '#F36689', - danger40: '#EF3E5E', - danger50: '#EB003B', - danger60: '#D50136', - danger70: '#8D0023', - danger80: '#5E0018', - danger90: '#2F000C', - - warning: '#FFB724', - warning5: '#FFF8E9', - warning10: '#FFEAC1', - warning20: '#FFE2A7', - warning30: '#FFD47C', - warning40: '#FFC550', - warning50: '#FFB724', - warning60: '#98690A', - warning70: '#66490E', - warning80: '#4D370B', - warning90: '#332507', - - success: '#008A1E', - success5: '#EEF7F0', - success10: '#CEE9D4', - success20: '#B2DCBB', - success30: '#8CCA99', - success40: '#33A14B', - success50: '#008A1E', - success60: '#006E18', - success70: '#005312', - success80: '#00370C', - success90: '#002207', - - info: '#2768FF', - info5: '#E9F0FF', - info10: '#D4E1FF', - info20: '#A9C3FF', - info30: '#7DA4FF', - info40: '#5286FF', - info50: '#2768FF', - info60: '#1F53CC', - info70: '#173E99', - info80: '#0C1F4D', - info90: '#040A1A', - - navy5: '#F1F1F9', - navy10: '#D3D5ED', - navy20: '#A7AEDA', - navy30: '#7B82C8', - navy40: '#4F57B5', - navy50: '#232EA3', - navy60: '#1C25B2', - navy70: '#151C62', - navy80: '#0E1241', - navy90: '#070921', - - blue5: '#F0F3FF', - blue10: '#D2DCFE', - blue20: '#A4B8FE', - blue30: '#7795FD', - blue40: '#4A71FC', - blue50: '#1C4EFC', - blue60: '#163ECA', - blue70: '#112F97', - blue80: '#0B1F65', - blue90: '#061032', - - royalBlue5: '#EBF5FF', - royalBlue10: '#C7E3FF', - royalBlue20: '#8FC8FF', - royalBlue30: '#56ACFF', - royalBlue40: '#0D76AE', - royalBlue50: '#0D76AE', - royalBlue60: '#0A5AA6', - royalBlue70: '#04407F', - royalBlue80: '#002B55', - royalBlue90: '#00152A', +// Color definitions for light and 'high-contrast' modes +export type ColorThemeMode = 'light' | 'high-contrast'; - skyBlue5: '#F0F8FF', - skyBlue10: '#D4F3FE', - skyBlue20: '#A9E6FC', - skyBlue30: '#7DDAFB', - skyBlue40: '#52CDFA', - skyBlue50: '#27C1F8', - skyBlue60: '#1F9AC6', - skyBlue70: '#177495', - skyBlue80: '#0F4D63', - skyBlue90: '#082732', - - aqua5: '#E7FDFD', - aqua10: '#CEFBFB', - aqua20: '#9CF6F6', - aqua30: '#6BF2F2', - aqua40: '#39EDED', - aqua50: '#08E8E8', - aqua60: '#06BABA', - aqua70: '#058C8C', - aqua80: '#035D5D', - aqua90: '#022F2F', - - teal5: '#EDF8F8', - teal10: '#CEEEED', - teal20: '#9DD7D7', - teal30: '#6DC3C3', - teal40: '#3CAEAE', - teal50: '#0B9B98', - teal60: '#097C7C', - teal70: '#075D5D', - teal80: '#043E3E', - teal90: '#021F1F', - - green5: '#EEF7EE', - green10: '#CCE6CC', - green20: '#99CC99', - green30: '#66B366', - green40: '#339933', - green50: '#008000', - green60: '#006600', - green70: '#004D00', - green80: '#003300', - green90: '#001A00', - - limeGreen5: '#F3FCF3', - limeGreen10: '#D6F5D6', - limeGreen20: '#ADEBAD', - limeGreen30: '#84E184', - limeGreen40: '#5BD75B', - limeGreen50: '#32CD32', - limeGreen60: '#28A428', - limeGreen70: '#1E7B1E', - limeGreen80: '#145214', - limeGreen90: '#0A290A', - - lime5: '#F7FEA', - lime10: '#EEFEDA', - lime20: '#DCFFAB', - lime30: '#CEFE83', - lime40: '#BCF95D', - lime50: '#A1F524', - lime60: '#8BD013', - lime70: '#6A9B16', - lime80: '#476912', - lime90: '#23570D', - - olive5: '#F8F8ED', - olive10: '#EBEBCC', - olive20: '#D6D699', - olive30: '#C2C266', - olive40: '#ADAD33', - olive50: '#999900', - olive60: '#7A7A00', - olive70: '#5C5C00', - olive80: '#3D3D00', - olive90: '#1F1F00', - - yellow5: '#FFFBE5', - yellow10: '#FFF4CC', - yellow20: '#FFEE99', - yellow30: '#FFE566', - yellow40: '#FFD033', - yellow50: '#FFD400', - yellow60: '#CCA300', - yellow70: '#A38200', - yellow80: '#665200', - yellow90: '#332900', +// Define all available color variables +export const colors = { + 'primary-5': { + light: '#ecf2fe', + 'high-contrast': '#ecf2fe', + }, + 'primary-10': { + light: '#d8e5fd', + 'high-contrast': '#d8e5fd', + }, + 'primary-20': { + light: '#b1cefb', + 'high-contrast': '#b1cefb', + }, + 'primary-30': { + light: '#86aff9', + 'high-contrast': '#86aff9', + }, + 'primary-40': { + light: '#4c87f6', + 'high-contrast': '#4c87f6', + }, + 'primary-50': { + light: '#256ef4', + 'high-contrast': '#256ef4', + }, + 'primary-60': { + light: '#0b50d0', + 'high-contrast': '#0b50d0', + }, + 'primary-70': { + light: '#083891', + 'high-contrast': '#083891', + }, + 'primary-80': { + light: '#052561', + 'high-contrast': '#052561', + }, + 'primary-90': { + light: '#03163a', + 'high-contrast': '#03163a', + }, + 'primary-95': { + light: '#020f27', + 'high-contrast': '#020f27', + }, - gold5: '#FDF7E9', - gold10: '#FAEFD3', - gold20: '#F5DFA7', - gold30: '#F1CF7A', - gold40: '#ECBF4E', - gold50: '#E7AF22', - gold60: '#B98C1B', - gold70: '#8B6915', - gold80: '#5C460E', - gold90: '#2E2307', + 'secondary-5': { + light: '#eef2f7', + 'high-contrast': '#edf6f8', + }, + 'secondary-10': { + light: '#d6e0eb', + 'high-contrast': '#d5ebf1', + }, + 'secondary-20': { + light: '#bacbde', + 'high-contrast': '#abd8e3', + }, + 'secondary-30': { + light: '#90b0d5', + 'high-contrast': '#75c0d1', + }, + 'secondary-40': { + light: '#6b96c7', + 'high-contrast': '#3d9fb8', + }, + 'secondary-50': { + light: '#346fb2', + 'high-contrast': '#268097', + }, + 'secondary-60': { + light: '#1c589c', + 'high-contrast': '#1f687a', + }, + 'secondary-70': { + light: '#063a74', + 'high-contrast': '#17505e', + }, + 'secondary-80': { + light: '#052b57', + 'high-contrast': '#113b45', + }, + 'secondary-90': { + light: '#031f3f', + 'high-contrast': '#0e3139', + }, + 'secondary-95': { + light: '#02162c', + 'high-contrast': '#091f25', + }, - saddleBrown5: '#F8F2ED', - saddleBrown10: '#ECDCCD', - saddleBrown20: '#D9B99C', - saddleBrown30: '#C6966A', - saddleBrown40: '#B37439', - saddleBrown50: '#A05107', - saddleBrown60: '#804106', - saddleBrown70: '#603104', - saddleBrown80: '#402003', - saddleBrown90: '#201001', + 'gray-0': { + light: '#ffffff', + 'high-contrast': '#ffffff', + }, + 'gray-5': { + light: '#f4f5f6', + 'high-contrast': '#f4f5f6', + }, + 'gray-10': { + light: '#e6e8ea', + 'high-contrast': '#e6e8ea', + }, + 'gray-20': { + light: '#cdd1d5', + 'high-contrast': '#cdd1d5', + }, + 'gray-30': { + light: '#b1b8be', + 'high-contrast': '#b1b8be', + }, + 'gray-40': { + light: '#8a949e', + 'high-contrast': '#8a949e', + }, + 'gray-50': { + light: '#6d7882', + 'high-contrast': '#6d7882', + }, + 'gray-60': { + light: '#58616a', + 'high-contrast': '#58616a', + }, + 'gray-70': { + light: '#464c53', + 'high-contrast': '#464c53', + }, + 'gray-80': { + light: '#33363d', + 'high-contrast': '#33363d', + }, + 'gray-90': { + light: '#1e2124', + 'high-contrast': '#1e2124', + }, + 'gray-95': { + light: '#131416', + 'high-contrast': '#131416', + }, + 'gray-100': { + light: '#000000', + 'high-contrast': '#000000', + }, - brown5: '#F9F2F0', - brown10: '#EED8D3', - brown20: '#DCB0A7', - brown30: '#CB897C', - brown40: '#B96150', - brown50: '#A83A24', - brown60: '#862E1D', - brown70: '#652316', - brown80: '#43170E', - brown90: '#220C07', + 'alpha-black100': { + light: '#000000', + 'high-contrast': '#000000', + }, + 'alpha-black75': { + light: '#000000bf', + 'high-contrast': '#000000bf', + }, + 'alpha-black50': { + light: '#00000080', + 'high-contrast': '#00000080', + }, + 'alpha-black25': { + light: '#00000040', + 'high-contrast': '#00000040', + }, + 'alpha-black10': { + light: '#0000001a', + 'high-contrast': '#0000001a', + }, + 'alpha-black0': { + light: '#00000000', + 'high-contrast': '#00000000', + }, + 'alpha-white100': { + light: '#ffffff', + 'high-contrast': '#ffffff', + }, + 'alpha-white75': { + light: '#ffffffbf', + 'high-contrast': '#ffffffbf', + }, + 'alpha-white50': { + light: '#ffffff80', + 'high-contrast': '#ffffff80', + }, + 'alpha-white25': { + light: '#ffffff40', + 'high-contrast': '#ffffff40', + }, + 'alpha-white10': { + light: '#ffffff1a', + 'high-contrast': '#ffffff1a', + }, + 'alpha-white0': { + light: '#ffffff00', + 'high-contrast': '#ffffff00', + }, - darkRed5: '#FAEFF0', - darkRed10: '#F1CED0', - darkRed20: '#E39D9F', - darkRed30: '#D56C6F', - darkRed40: '#C73A3F', - darkRed50: '#B9090F', - darkRed60: '#94070C', - darkRed70: '#6F0509', - darkRed80: '#4A0306', - darkRed90: '#250203', + 'danger-5': { + light: '#fdefec', + 'high-contrast': '#fdefec', + }, + 'danger-10': { + light: '#fcdfd9', + 'high-contrast': '#fcdfd9', + }, + 'danger-20': { + light: '#f7afa1', + 'high-contrast': '#f7afa1', + }, + 'danger-30': { + light: '#f48771', + 'high-contrast': '#f48771', + }, + 'danger-40': { + light: '#f05f42', + 'high-contrast': '#f05f42', + }, + 'danger-50': { + light: '#de3412', + 'high-contrast': '#de3412', + }, + 'danger-60': { + light: '#bd2c0f', + 'high-contrast': '#bd2c0f', + }, + 'danger-70': { + light: '#8a240f', + 'high-contrast': '#8a240f', + }, + 'danger-80': { + light: '#5c180a', + 'high-contrast': '#5c180a', + }, + 'danger-90': { + light: '#390d05', + 'high-contrast': '#390d05', + }, + 'danger-95': { + light: '#260903', + 'high-contrast': '#260903', + }, - red5: '#FEF1F1', - red10: '#FCCBCC', - red20: '#F99999', - red30: '#F56666', - red40: '#F23B3B', - red50: '#EE0000', - red60: '#BE0000', - red70: '#8F0000', - red80: '#5F0000', - red90: '#300000', + 'information-5': { + light: '#e7f4fe', + 'high-contrast': '#e7f4fe', + }, + 'information-10': { + light: '#d3ebfd', + 'high-contrast': '#d3ebfd', + }, + 'information-20': { + light: '#9ed2fa', + 'high-contrast': '#9ed2fa', + }, + 'information-30': { + light: '#5fb5f7', + 'high-contrast': '#5fb5f7', + }, + 'information-40': { + light: '#2098f3', + 'high-contrast': '#2098f3', + }, + 'information-50': { + light: '#0b78cb', + 'high-contrast': '#0b78cb', + }, + 'information-60': { + light: '#096ab3', + 'high-contrast': '#096ab3', + }, + 'information-70': { + light: '#085691', + 'high-contrast': '#085691', + }, + 'information-80': { + light: '#053961', + 'high-contrast': '#053961', + }, + 'information-90': { + light: '#03253f', + 'high-contrast': '#03253f', + }, + 'information-95': { + light: '#021a2c', + 'high-contrast': '#021a2c', + }, - orange5: '#FFF4F0', - orange10: '#FFD4CC', - orange20: '#FFB899', - orange30: '#FF9C66', - orange40: '#FF8033', - orange50: '#FF6400', - orange60: '#CC5000', - orange70: '#993C00', - orange80: '#662800', - orange90: '#331400', + 'warning-5': { + light: '#fff3db', + 'high-contrast': '#fff3db', + }, + 'warning-10': { + light: '#ffe0a3', + 'high-contrast': '#ffe0a3', + }, + 'warning-20': { + light: '#ffc95c', + 'high-contrast': '#ffc95c', + }, + 'warning-30': { + light: '#ffb114', + 'high-contrast': '#ffb114', + }, + 'warning-40': { + light: '#c78500', + 'high-contrast': '#c78500', + }, + 'warning-50': { + light: '#9e6a00', + 'high-contrast': '#9e6a00', + }, + 'warning-60': { + light: '#8a5c00', + 'high-contrast': '#8a5c00', + }, + 'warning-70': { + light: '#614100', + 'high-contrast': '#614100', + }, + 'warning-80': { + light: '#422c00', + 'high-contrast': '#422c00', + }, + 'warning-90': { + light: '#2e1f00', + 'high-contrast': '#2e1f00', + }, + 'warning-95': { + light: '#241800', + 'high-contrast': '#241800', + }, - coral5: '#FFF8F5', - coral10: '#FFE6DC', - coral20: '#FFCDB8', - coral30: '#FFB495', - coral40: '#FF9B71', - coral50: '#FE8052', - coral60: '#CB6642', - coral70: '#984D31', - coral80: '#663321', - coral90: '#331A10', + 'success-5': { + light: '#eaf6ec', + 'high-contrast': '#eaf6ec', + }, + 'success-10': { + light: '#d8eedd', + 'high-contrast': '#d8eedd', + }, + 'success-20': { + light: '#a9dab4', + 'high-contrast': '#a9dab4', + }, + 'success-30': { + light: '#7ec88e', + 'high-contrast': '#7ec88e', + }, + 'success-40': { + light: '#3fa654', + 'high-contrast': '#3fa654', + }, + 'success-50': { + light: '#228738', + 'high-contrast': '#228738', + }, + 'success-60': { + light: '#267337', + 'high-contrast': '#267337', + }, + 'success-70': { + light: '#285d33', + 'high-contrast': '#285d33', + }, + 'success-80': { + light: '#1f4727', + 'high-contrast': '#1f4727', + }, + 'success-90': { + light: '#122b18', + 'high-contrast': '#122b18', + }, + 'success-95': { + light: '#0e2012', + 'high-contrast': '#0e2012', + }, - salmon5: '#FFF1F0', - salmon10: '#FFE3E0', - salmon20: '#FFCBC1', - salmon30: '#FEACA3', - salmon40: '#FE9184', - salmon50: '#FD7565', - salmon60: '#CA5E51', - salmon70: '#97463D', - salmon80: '#652F28', - salmon90: '#321714', + 'point-5': { + light: '#fbeff0', + 'high-contrast': '#fbeff0', + }, + 'point-10': { + light: '#f5d6d9', + 'high-contrast': '#f5d6d9', + }, + 'point-20': { + light: '#ebadb2', + 'high-contrast': '#ebadb2', + }, + 'point-30': { + light: '#e0858c', + 'high-contrast': '#e0858c', + }, + 'point-40': { + light: '#d65c66', + 'high-contrast': '#d65c66', + }, + 'point-50': { + light: '#d63d4a', + 'high-contrast': '#d63d4a', + }, + 'point-60': { + light: '#ab2b36', + 'high-contrast': '#ab2b36', + }, + 'point-70': { + light: '#7a1f26', + 'high-contrast': '#7a1f26', + }, + 'point-80': { + light: '#521419', + 'high-contrast': '#521419', + }, + 'point-90': { + light: '#310c0f', + 'high-contrast': '#310c0f', + }, + 'point-95': { + light: '#21080a', + 'high-contrast': '#21080a', + }, - hotPink5: '#FFF5FC', - hotPink10: '#FFE3F5', - hotPink20: '#FFC4EC', - hotPink30: '#FFAAE2', - hotPink40: '#FF8DD9', - hotPink50: '#FF6FCE', - hotPink60: '#CC59A5', - hotPink70: '#99437C', - hotPink80: '#662C53', - hotPink90: '#331629', + 'graphic-10': { + light: '#e5ecf9', + 'high-contrast': '#e5ecf9', + }, + 'graphic-30': { + light: '#98acc5', + 'high-contrast': '#98acc5', + }, + 'graphic-50': { + light: '#61758f', + 'high-contrast': '#61758f', + }, + 'graphic-70': { + light: '#39506c', + 'high-contrast': '#39506c', + }, + 'graphic-90': { + light: '#223a58', + 'high-contrast': '#223a58', + }, +}; - pink5: '#FFF0F8', - pink10: '#FFD0E9', - pink20: '#FFA1D4', - pink30: '#FF72BE', - pink40: '#FF43A9', - pink50: '#FF1493', - pink60: '#CC1076', - pink70: '#990C58', - pink80: '#66083B', - pink90: '#33041D', +// Helper function to get color by mode +export const getColor = ( + colorName: keyof typeof colors, + mode: ColorThemeMode = 'light', +): string => { + return colors[colorName][mode]; +}; - fuchsia5: '#FDF2FD', - fuchsia10: '#F9D1F9', - fuchsia20: '#F2A3F2', - fuchsia30: '#EC75EC', - fuchsia40: '#E547E5', - fuchsia50: '#DF19DF', - fuchsia60: '#B214B2', - fuchsia70: '#8B0F8B', - fuchsia80: '#590A59', - fuchsia90: '#2D052D', +// Helper to get all colors for a specified mode +export const getThemeColors = ( + mode: ColorThemeMode = 'light', +): Record => { + const themeColors: Record = {}; - purple5: '#F5EEF7', - purple10: '#E1CCE6', - purple20: '#C499CC', - purple30: '#A666B3', - purple40: '#893399', - purple50: '#600080', - purple60: '#4D0066', - purple70: '#3A004D', - purple80: '#260033', - purple90: '#13001A', + Object.entries(colors).forEach(([colorName, modeValues]) => { + themeColors[colorName] = modeValues[mode]; + }); - blueViolet5: '#F4EFFA', - blueViolet10: '#DED1F1', - blueViolet20: '#BDA2E3', - blueViolet30: '#9B74D4', - blueViolet40: '#7A45C6', - blueViolet50: '#5917B8', - blueViolet60: '#471293', - blueViolet70: '#350E6E', - blueViolet80: '#24094A', - blueViolet90: '#120525', + return themeColors; }; diff --git a/packages/core/lib/colors/color.type.ts b/packages/core/lib/colors/color.type.ts deleted file mode 100644 index b2bcdc3..0000000 --- a/packages/core/lib/colors/color.type.ts +++ /dev/null @@ -1,223 +0,0 @@ -type PrimaryColors = - | 'primary' - | 'primary-0' - | 'primary-5' - | 'primary-10' - | 'primary-20' - | 'primary-30' - | 'primary-40' - | 'primary-50' - | 'primary-60' - | 'primary-70' - | 'primary-80' - | 'primary-90' - | 'primary-100'; - -type SecondaryColors = - | 'secondary' - | 'secondary-0' - | 'secondary-5' - | 'secondary-10' - | 'secondary-20' - | 'secondary-30' - | 'secondary-40' - | 'secondary-50' - | 'secondary-60' - | 'secondary-70' - | 'secondary-80' - | 'secondary-90' - | 'secondary-100'; - -type GrayColors = - | 'gray-0' - | 'gray-5' - | 'gray-10' - | 'gray-20' - | 'gray-30' - | 'gray-40' - | 'gray-50' - | 'gray-60' - | 'gray-70' - | 'gray-80' - | 'gray-90' - | 'gray-100'; - -type PointColors = - | 'point' - | 'point-0' - | 'point-5' - | 'point-10' - | 'point-20' - | 'point-30' - | 'point-40' - | 'point-50' - | 'point-60' - | 'point-70' - | 'point-80' - | 'point-90' - | 'point-100'; - -type DangerColors = - | 'danger' - | 'danger-5' - | 'danger-10' - | 'danger-20' - | 'danger-30' - | 'danger-40' - | 'danger-50' - | 'danger-60' - | 'danger-70' - | 'danger-80' - | 'danger-90'; - -type WarningColors = - | 'warning' - | 'warning-5' - | 'warning-10' - | 'warning-20' - | 'warning-30' - | 'warning-40' - | 'warning-50' - | 'warning-60' - | 'warning-70' - | 'warning-80' - | 'warning-90'; - -type SuccessColors = - | 'success' - | 'success-5' - | 'success-10' - | 'success-20' - | 'success-30' - | 'success-40' - | 'success-50' - | 'success-60' - | 'success-70' - | 'success-80' - | 'success-90'; - -type InfoColors = - | 'info' - | 'info-5' - | 'info-10' - | 'info-20' - | 'info-30' - | 'info-40' - | 'info-50' - | 'info-60' - | 'info-70' - | 'info-80' - | 'info-90'; - -export type Color = - | PrimaryColors - | SecondaryColors - | GrayColors - | PointColors - | DangerColors - | WarningColors - | SuccessColors - | InfoColors; - -export const getTextColorClassname = (color: Color): string => { - const colorClassMap = { - primary: 'text-primary', - 'primary-0': 'text-primary-0', - 'primary-5': 'text-primary-5', - 'primary-10': 'text-primary-10', - 'primary-20': 'text-primary-20', - 'primary-30': 'text-primary-30', - 'primary-40': 'text-primary-40', - 'primary-50': 'text-primary-50', - 'primary-60': 'text-primary-60', - 'primary-70': 'text-primary-70', - 'primary-80': 'text-primary-80', - 'primary-90': 'text-primary-90', - 'primary-100': 'text-primary-100', - secondary: 'text-secondary', - 'secondary-0': 'text-secondary-0', - 'secondary-5': 'text-secondary-5', - 'secondary-10': 'text-secondary-10', - 'secondary-20': 'text-secondary-20', - 'secondary-30': 'text-secondary-30', - 'secondary-40': 'text-secondary-40', - 'secondary-50': 'text-secondary-50', - 'secondary-60': 'text-secondary-60', - 'secondary-70': 'text-secondary-70', - 'secondary-80': 'text-secondary-80', - 'secondary-90': 'text-secondary-90', - 'secondary-100': 'text-secondary-100', - gray: 'text-gray', - 'gray-0': 'text-gray-0', - 'gray-5': 'text-gray-5', - 'gray-10': 'text-gray-10', - 'gray-20': 'text-gray-20', - 'gray-30': 'text-gray-30', - 'gray-40': 'text-gray-40', - 'gray-50': 'text-gray-50', - 'gray-60': 'text-gray-60', - 'gray-70': 'text-gray-70', - 'gray-80': 'text-gray-80', - 'gray-90': 'text-gray-90', - 'gray-100': 'text-gray-100', - point: 'text-point', - 'point-0': 'text-point-0', - 'point-5': 'text-point-5', - 'point-10': 'text-point-10', - 'point-20': 'text-point-20', - 'point-30': 'text-point-30', - 'point-40': 'text-point-40', - 'point-50': 'text-point-50', - 'point-60': 'text-point-60', - 'point-70': 'text-point-70', - 'point-80': 'text-point-80', - 'point-90': 'text-point-90', - 'point-100': 'text-point-100', - danger: 'text-danger', - 'danger-5': 'text-danger-5', - 'danger-10': 'text-danger-10', - 'danger-20': 'text-danger-20', - 'danger-30': 'text-danger-30', - 'danger-40': 'text-danger-40', - 'danger-50': 'text-danger-50', - 'danger-60': 'text-danger-60', - 'danger-70': 'text-danger-70', - 'danger-80': 'text-danger-80', - 'danger-90': 'text-danger-90', - warning: 'text-warning', - 'warning-5': 'text-warning-5', - 'warning-10': 'text-warning-10', - 'warning-20': 'text-warning-20', - 'warning-30': 'text-warning-30', - 'warning-40': 'text-warning-40', - 'warning-50': 'text-warning-50', - 'warning-60': 'text-warning-60', - 'warning-70': 'text-warning-70', - 'warning-80': 'text-warning-80', - 'warning-90': 'text-warning-90', - success: 'text-success', - 'success-5': 'text-success-5', - 'success-10': 'text-success-10', - 'success-20': 'text-success-20', - 'success-30': 'text-success-30', - 'success-40': 'text-success-40', - 'success-50': 'text-success-50', - 'success-60': 'text-success-60', - 'success-70': 'text-success-70', - 'success-80': 'text-success-80', - 'success-90': 'text-success-90', - info: 'text-info', - 'info-5': 'text-info-5', - 'info-10': 'text-info-10', - 'info-20': 'text-info-20', - 'info-30': 'text-info-30', - 'info-40': 'text-info-40', - 'info-50': 'text-info-50', - 'info-60': 'text-info-60', - 'info-70': 'text-info-70', - 'info-80': 'text-info-80', - 'info-90': 'text-info-90', - }; - - return colorClassMap[color]; -}; diff --git a/packages/core/lib/components/Body.tsx b/packages/core/lib/components/Body.tsx index 7eb479f..ea4cda9 100644 --- a/packages/core/lib/components/Body.tsx +++ b/packages/core/lib/components/Body.tsx @@ -1,9 +1,6 @@ -import { Color, getTextColorClassname } from '../colors/color.type'; - export type BodyProps = { size?: 'l' | 'm' | 's'; weight?: 'regular' | 'bold'; - color?: Color; children: React.ReactNode; className?: string; } & React.ComponentPropsWithoutRef; @@ -26,7 +23,7 @@ export const Body = ({ regular: 'font-regular', bold: 'font-bold', }[weight]; - const textColorClass = getTextColorClassname(color); + const textColorClass = ''; return (

= { size?: 'l' | 'm' | 's'; weight?: 'regular' | 'bold'; - color?: Color; children: React.ReactNode; className?: string; } & React.ComponentPropsWithoutRef; @@ -26,7 +23,7 @@ export const Detail = ({ regular: 'font-regular', bold: 'font-bold', }[weight]; - const textColorClass = getTextColorClassname(color); + const textColorClass = ''; return ( = { size?: 'l' | 'm' | 's'; - color?: Color; children: React.ReactNode; className?: string; } & React.ComponentPropsWithoutRef; @@ -20,7 +17,7 @@ export const Display = ({ s: 'text-display-s-mobile sm:text-display-s', }[size]; const weightClass = 'font-bold'; - const textColorClass = getTextColorClassname(color); + const textColorClass = ''; return (

= { size?: 'l' | 'm' | 's'; - color?: Color; children: React.ReactNode; className?: string; } & React.ComponentPropsWithoutRef; @@ -20,7 +17,7 @@ export const Heading = ({ s: 'text-heading-s-mobile sm:text-heading-s', }[size]; const weightClass = 'font-bold'; - const textColorClass = getTextColorClassname(color); + const textColorClass = ''; return (

= { size?: 'l' | 'm' | 's' | 'xs'; weight?: 'regular' | 'bold'; - color?: Color; children: React.ReactNode; className?: string; } & React.ComponentPropsWithoutRef; @@ -11,7 +8,6 @@ export type LabelProps = { export const Label = ({ size = 'm', weight = 'regular', - color = 'gray-90', children, className = '', ...props @@ -27,7 +23,7 @@ export const Label = ({ regular: 'font-regular', bold: 'font-bold', }[weight]; - const textColorClass = getTextColorClassname(color); + const textColorClass = ''; return (