Files
Rabby/tailwind.config.js
richardo2016x bb194cb797 feat: partial support dark mode on debug. (#1840)
* style: add dark mode about css vars.

* feat: support reactive theme mode.

* feat: try to apply dark mode on dashboard/send-token.

* feat: support dark mode for NFTView.

* feat: checkout partial from bg-state-hooks feature to support reactive theme mode.

* feat: basic support dark mode for More.

* feat: only enable dark mode on DEBUG.

* feat: basic support dark mode for Current Address.

* feat: basic support of dark mode for address-management about workflow

* feat: basic dark mode support for entry of hardware wallet connect.

* feat: parital support of dark mode for send-token about workflow.

* style: for themMode, swap light's value with system's.

* feat: parital support of dark mode for approval.

* fix: some icons' size, normalize all default value of `--r-neutral-foot` as light mode.

* fix: props assigned to svg component.

* feat: parital support of dark mode for entry of swap & signature.

* style: tuning styles for address/txs/send about UI.

* style: tuning style for swap about UIs.

* style: tuning for Token Selector

* style: tuning for Swap Quotes.

* style: tuning for Sort Address popup.

* fix: normalize isDarkOnSystem for both css/icon.

* feat: support dark mode for all sub popup/pages from 'More'(Settings)

* style: little fix.

* fix: darkmode support for NFT UIs

* style: darkmode tuning for Add-an-address & ChainSelector-button

* style: update icon's color on More popup.

* style: support dark mode for import-my-metamask

* style: tuning darkmode for signText approval.

* style: tuning darkmode for addr management.

* style: tuning darkmode for complex sign approval.

* style: fix some style on darkmode.

* style: support darkmode for asset list in dashboard.

* style: fix some cases on darkmode.

* chore: little fix.

* chore: robust change.

* feat: support darkmode on Unlock page.

* fix: constant.

* fix: darkmode support for safe type address.

* feat: changelog and pending approval modal

* fix: dork mode for safe and cobo safe

* fix: safe nonce selector

* fix: input style in Unlock page.

* fix: wallet brand logo's display on manage-address header & del-address-modal.

* fix: keystone icon

* style: dark mode tuning.

* feat: lock to light mode for Tab page on production.

* style: dark mode tuning.

* style: dark mode fix.

* chore: style tuning.

* style: update most colors to opaque version.

* chore: style tuning.

* feat: coinbase keyring

* chore: update keyring

* fix: border width

* fix: make linter happy

* fix: connected

* fix: remove resetConnect

* chore: update keyring

* fix: connect

* chore: update keyring

* fix: coinbase light icon

* style: dark mode tuning.

* feat: enable theme switch entry.

* chore: code cleanup.

* style: fix and dark mode tuning.

* chore: style tuning.

* style: tuning style for security level.

* fix: sign waiting style on darkmode.

* style: fix.

* style: fix style on dark mode.

* style: dark mode tuning.

* chore: style tuning.

* feat: + changelog

---------

Co-authored-by: vvvvvv1vvvvvv <galennnnnnn@gmail.com>
Co-authored-by: heisenberg <heisenberg-2077@outlook.com>
2023-12-01 20:35:32 +08:00

152 lines
3.3 KiB
JavaScript

const colors = require('tailwindcss/colors');
const tinycolor2 = require('tinycolor2');
const { themeColors, rabbyCssPrefix } = require('./src/constant/theme-colors');
const rabbyColors = ['light', 'dark'].reduce((accu, theme) => {
Object.entries(themeColors[theme]).forEach(([cssvarKey, colorValue]) => {
// const splitorIdx = cssvarKey.indexOf('-');
// const group = cssvarKey.slice(0, splitorIdx);
// const suffix = cssvarKey.slice(splitorIdx + 1);
const tinyColor = tinycolor2(colorValue);
const alpha = tinyColor.getAlpha();
const hexValue = alpha === 1 ? tinyColor.toHexString() : tinyColor.toHex8String();
if (!accu.auto[cssvarKey]) {
accu.auto[cssvarKey] = `var(--${rabbyCssPrefix}${cssvarKey}, ${hexValue})`;
}
accu[theme][cssvarKey] = hexValue;
});
return accu;
}, {
light: {},
dark: {},
auto: {},
});
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: 'jit',
purge: ['./src/ui/**/*.{ts,tsx,html}'],
theme: {
spacing: [
0,
1,
2,
4,
6,
8,
10,
12,
14,
16,
18,
20,
24,
28,
32,
40,
60,
80,
].reduce((m, n) => {
m[n] = `${n}px`;
return m;
}, {}),
screens: {
sm: { max: '600px' },
lg: { min: '600px' },
},
colors: {
transparent: 'transparent',
current: 'currentColor',
blue: {
from: '#8A78FD',
to: '#796BFD',
light: rabbyColors.light['blue-default'],
DEFAULT: '#796BFD',
purple: '#5F75FF',
},
black: '#707280',
green: '#27C193',
white: colors.white,
yellow: '#F29C1B',
orange: '#FFB020',
pink: '#F24822',
red: {
light: '#F24822',
DEFAULT: '#AF160E',
forbidden: '#EC5151',
},
gray: {
bg2: '#F5F6FA',
bg: '#F5F6FA',
divider: '#E5E9EF',
comment: '#B4BDCC',
content: '#707280',
subTitle: '#4B4D59',
title: '#13141A',
light: '#707880',
common: '#666666',
},
},
fontSize: {
12: [
'12px',
{
lineHeight: '14px',
},
],
13: '13px',
14: [
'14px',
{
lineHeight: '18px',
},
],
15: [
'15px',
{
lineHeight: '18px',
},
],
18: [
'18px',
{
lineHeight: '22px',
},
],
20: '20px',
24: [
'24px',
{
lineHeight: '28px',
},
],
28: [
'28px',
{
lineHeight: '33px',
},
],
},
/** @notice configuration here would override the default config above */
extend: {
colors: {
[`${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.auto,
[`${'rabby-'.replace(/\-$/, '')}`]: rabbyColors.auto,
[`${'-r-'.replace(/\-$/, '')}`]: rabbyColors.auto,
[`light-${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.light,
[`dark-${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.dark,
}
},
},
// use class insteadof media-query prefers-color-scheme
// see https://v2.tailwindcss.com/docs/dark-mode
darkMode: 'class',
important: true,
};