Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BitFun-Installer/src/pages/ThemeSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function ThemeSetup({ options, setOptions, onLaunch, onClose }: ThemeSetu
<div style={{ ...previewBaseStyle, background: theme.colors.background.primary }}>
<div style={{ height: 16, background: theme.colors.background.secondary, opacity: 0.9 }} />
<div style={{ display: 'flex', gap: 6, padding: 8 }}>
<div style={{ width: 22, height: 22, borderRadius: 5, background: theme.colors.element.base, opacity: 0.9 }} />
<div style={{ width: 22, height: 22, borderRadius: 5, background: theme.colors.element.soft, opacity: 0.9 }} />
<div style={{ flex: 1 }}>
<div style={{ height: 5, width: '62%', background: theme.colors.text.muted, opacity: 0.5, borderRadius: 3, marginBottom: 5 }} />
<div style={{ height: 5, width: '78%', background: theme.colors.accent['500'], borderRadius: 3 }} />
Expand Down
24 changes: 0 additions & 24 deletions BitFun-Installer/src/styles/variables.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
:root {
--color-bg-primary: #121214;
--color-bg-secondary: #1a1c1e;
--color-bg-tertiary: var(--color-bg-primary);
--color-bg-quaternary: var(--color-bg-secondary);
--color-bg-elevated: var(--color-bg-secondary);
--color-bg-workbench: var(--color-bg-primary);
--color-bg-flowchat: var(--color-bg-primary);
--color-bg-tooltip: rgba(30, 30, 32, 0.92);

--color-text-primary: #e8e8e8;
--color-text-secondary: #b0b0b0;
--color-text-muted: #858585;
--color-text-disabled: #555555;

--color-accent-50: rgba(96, 165, 250, 0.04);
--color-accent-100: rgba(96, 165, 250, 0.08);
Expand All @@ -21,37 +14,20 @@
--color-accent-500: #60a5fa;
--color-accent-600: #3b82f6;

--color-purple-50: var(--color-accent-50);
--color-purple-100: var(--color-accent-100);
--color-purple-200: var(--color-accent-200);
--color-purple-400: var(--color-accent-400);
--color-purple-500: var(--color-accent-500);
--color-purple-600: var(--color-accent-600);
--color-purple-800: var(--color-accent-600);

--color-success: #34d399;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: var(--color-accent-500);
--color-highlight: var(--color-warning);
--color-highlight-bg: rgba(245, 158, 11, 0.15);

--element-bg-subtle: rgba(255, 255, 255, 0.06);
--element-bg-soft: rgba(255, 255, 255, 0.12);
--element-bg-base: var(--element-bg-soft);
--element-bg-medium: rgba(255, 255, 255, 0.18);
--element-bg-strong: rgba(255, 255, 255, 0.24);
--element-bg-elevated: var(--element-bg-strong);

--border-subtle: rgba(255, 255, 255, 0.12);
--border-base: rgba(255, 255, 255, 0.18);
--border-medium: rgba(255, 255, 255, 0.24);
--border-strong: rgba(255, 255, 255, 0.32);
--border-prominent: rgba(255, 255, 255, 0.45);

--size-radius-sm: 6px;
--size-radius-base: 8px;
--size-radius-lg: 12px;

--font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei',
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display',
Expand Down
19 changes: 0 additions & 19 deletions BitFun-Installer/src/theme/installerThemeRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { InstallerTheme } from './installerThemesData';
import { findInstallerThemeById } from './installerThemesData';

const ACCENT_STOPS = ['50', '100', '200', '300', '400', '500', '600'] as const;
const SECONDARY_ACCENT_STOPS = ['50', '100', '200', '400', '500', '600', '800'] as const;

/** Same rule as main app `getSystemPreferredDefaultThemeId`: dark -> bitfun-dark, else bitfun-light. */
export function getSystemPreferredBuiltinThemeId(): ThemeId {
Expand All @@ -20,42 +19,24 @@ export function applyInstallerThemeToDocument(theme: InstallerTheme): void {

root.style.setProperty('--color-bg-primary', colors.background.primary);
root.style.setProperty('--color-bg-secondary', colors.background.secondary);
root.style.setProperty('--color-bg-tertiary', colors.background.tertiary);
root.style.setProperty('--color-bg-quaternary', colors.background.quaternary);
root.style.setProperty('--color-bg-elevated', colors.background.elevated);
root.style.setProperty('--color-bg-workbench', colors.background.workbench);
root.style.setProperty('--color-bg-flowchat', colors.background.flowchat);
root.style.setProperty('--color-bg-tooltip', colors.background.tooltip ?? colors.background.elevated);
root.style.setProperty('--color-text-primary', colors.text.primary);
root.style.setProperty('--color-text-secondary', colors.text.secondary);
root.style.setProperty('--color-text-muted', colors.text.muted);
root.style.setProperty('--color-text-disabled', colors.text.disabled);
root.style.setProperty('--element-bg-subtle', colors.element.subtle);
root.style.setProperty('--element-bg-soft', colors.element.soft);
root.style.setProperty('--element-bg-base', colors.element.base);
root.style.setProperty('--element-bg-medium', colors.element.medium);
root.style.setProperty('--element-bg-strong', colors.element.strong);
root.style.setProperty('--element-bg-elevated', colors.element.elevated);
root.style.setProperty('--border-subtle', colors.border.subtle);
root.style.setProperty('--border-base', colors.border.base);
root.style.setProperty('--border-medium', colors.border.medium);
root.style.setProperty('--border-strong', colors.border.strong);
root.style.setProperty('--border-prominent', colors.border.prominent);
root.style.setProperty('--color-success', colors.semantic.success);
root.style.setProperty('--color-warning', colors.semantic.warning);
root.style.setProperty('--color-error', colors.semantic.error);
root.style.setProperty('--color-info', colors.semantic.info);
root.style.setProperty('--color-highlight', colors.semantic.highlight);
root.style.setProperty('--color-highlight-bg', colors.semantic.highlightBg);

ACCENT_STOPS.forEach((key) => {
root.style.setProperty(`--color-accent-${key}`, colors.accent[key]);
});

SECONDARY_ACCENT_STOPS.forEach((key) => {
root.style.setProperty(`--color-purple-${key}`, colors.purple[key]);
});

root.setAttribute('data-theme', theme.id);
root.setAttribute('data-theme-type', theme.type);
}
Expand Down
81 changes: 16 additions & 65 deletions BitFun-Installer/src/theme/installerThemesData.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { ThemeId } from '../types/installer';

type AccentStop = '50' | '100' | '200' | '300' | '400' | '500' | '600';
type SecondaryAccentStop = Exclude<AccentStop, '300'> | '800';
type AccentRamp = Record<AccentStop, string>;
type SecondaryAccentRamp = Record<SecondaryAccentStop, string>;
type RampAlphas = readonly [string, string, string, string, string];
type BackgroundColors = InstallerTheme['colors']['background'];
type TextColors = InstallerTheme['colors']['text'];
Expand All @@ -19,43 +17,28 @@ export type InstallerTheme = {
background: {
primary: string;
secondary: string;
tertiary: string;
quaternary: string;
elevated: string;
workbench: string;
flowchat: string;
tooltip: string;
};
text: {
primary: string;
secondary: string;
muted: string;
disabled: string;
};
accent: AccentRamp;
purple: SecondaryAccentRamp;
semantic: {
success: string;
warning: string;
error: string;
info: string;
highlight: string;
highlightBg: string;
};
border: {
subtle: string;
base: string;
medium: string;
strong: string;
prominent: string;
};
element: {
subtle: string;
soft: string;
base: string;
medium: string;
strong: string;
elevated: string;
};
};
};
Expand Down Expand Up @@ -86,21 +69,9 @@ function createAccentRamp(
};
}

function createSecondaryRampFromAccent(ramp: AccentRamp): SecondaryAccentRamp {
return {
'50': ramp['50'],
'100': ramp['100'],
'200': ramp['200'],
'400': ramp['400'],
'500': ramp['500'],
'600': ramp['600'],
'800': ramp['600'],
};
}

type TonePreset = {
text: TextColors;
semantic: Omit<SemanticColors, 'info' | 'highlight'>;
semantic: SemanticColors;
border: BorderColors;
element: ElementColors;
};
Expand All @@ -112,8 +83,6 @@ type ThemeSeed = {
background: {
primary: string;
secondary?: string;
tooltipRgb: string;
tooltipAlpha?: string;
};
accentRgb: string;
accent500: string;
Expand All @@ -126,58 +95,46 @@ function createBackground(seed: ThemeSeed['background']): BackgroundColors {
return {
primary: seed.primary,
secondary,
tertiary: seed.primary,
quaternary: secondary,
elevated: secondary,
workbench: seed.primary,
flowchat: seed.primary,
tooltip: alpha(seed.tooltipRgb, seed.tooltipAlpha ?? '0.95'),
};
}

function createBorderRamp(rgb: string, alphas: readonly [string, string, string, string, string]): BorderColors {
function createBorderRamp(rgb: string, alphas: readonly [string, string, string]): BorderColors {
return {
subtle: alpha(rgb, alphas[0]),
base: alpha(rgb, alphas[1]),
medium: alpha(rgb, alphas[2]),
strong: alpha(rgb, alphas[3]),
prominent: alpha(rgb, alphas[4]),
};
}

function createElementRamp(rgb: string, elevated: string): ElementColors {
function createElementRamp(rgb: string): ElementColors {
return {
subtle: alpha(rgb, '0.06'),
soft: alpha(rgb, '0.12'),
base: alpha(rgb, '0.12'),
medium: alpha(rgb, '0.18'),
strong: alpha(rgb, '0.24'),
elevated,
};
}

const DARK_TONE: TonePreset = {
text: { primary: '#e8e8e8', secondary: '#b0b0b0', muted: '#858585', disabled: '#555555' },
text: { primary: '#e8e8e8', secondary: '#b0b0b0', muted: '#858585' },
semantic: {
success: '#34d399',
warning: '#f59e0b',
error: '#ef4444',
highlightBg: alpha('245, 158, 11', '0.15'),
},
border: createBorderRamp('255, 255, 255', ['0.12', '0.18', '0.24', '0.32', '0.45']),
element: createElementRamp('255, 255, 255', alpha('255, 255, 255', '0.24')),
border: createBorderRamp('255, 255, 255', ['0.12', '0.18', '0.24']),
element: createElementRamp('255, 255, 255'),
};

const LIGHT_TONE: TonePreset = {
text: { primary: '#1e293b', secondary: '#3d4f66', muted: '#64748b', disabled: '#94a3b8' },
text: { primary: '#1e293b', secondary: '#3d4f66', muted: '#64748b' },
semantic: {
success: '#5b9a6f',
warning: '#c08c42',
error: '#c26565',
highlightBg: alpha('192, 140, 66', '0.12'),
},
border: createBorderRamp('100, 116, 139', ['0.15', '0.22', '0.32', '0.42', '0.52']),
element: createElementRamp('71, 102, 143', alpha('255, 255, 255', '0.92')),
border: createBorderRamp('100, 116, 139', ['0.15', '0.22', '0.32']),
element: createElementRamp('71, 102, 143'),
};

function createInstallerTheme(seed: ThemeSeed): InstallerTheme {
Expand All @@ -192,14 +149,10 @@ function createInstallerTheme(seed: ThemeSeed): InstallerTheme {
background: createBackground(seed.background),
text: { ...tone.text },
accent,
purple: createSecondaryRampFromAccent(accent),
semantic: {
success: tone.semantic.success,
warning: tone.semantic.warning,
error: tone.semantic.error,
info: accent['500'],
highlight: tone.semantic.warning,
highlightBg: tone.semantic.highlightBg,
...seed.semantic,
},
border: { ...tone.border },
Expand All @@ -216,8 +169,6 @@ export const THEMES: InstallerTheme[] = [
background: {
primary: '#121214',
secondary: '#1a1c1e',
tooltipRgb: '30, 30, 32',
tooltipAlpha: '0.92',
},
accentRgb: DEFAULT_BLUE_RGB,
accent500: DEFAULT_BLUE_500,
Expand All @@ -227,7 +178,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-light',
name: 'Light',
type: 'light',
background: { primary: '#f7f8fa', secondary: '#ffffff', tooltipRgb: '255, 255, 255', tooltipAlpha: '0.98' },
background: { primary: '#f7f8fa', secondary: '#ffffff' },
accentRgb: '71, 102, 143',
accent500: '#5a7bb2',
accent600: '#4a6694',
Expand All @@ -236,7 +187,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-midnight',
name: 'Midnight',
type: 'dark',
background: { primary: '#2b2d30', secondary: '#1e1f22', tooltipRgb: '43, 45, 48', tooltipAlpha: '0.94' },
background: { primary: '#2b2d30', secondary: '#1e1f22' },
accentRgb: DEFAULT_BLUE_RGB,
accent500: DEFAULT_BLUE_500,
accent600: DEFAULT_BLUE_600,
Expand All @@ -250,7 +201,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-china-style',
name: 'Ink Charm',
type: 'light',
background: { primary: '#faf8f0', secondary: '#f5f3e8', tooltipRgb: '250, 248, 240', tooltipAlpha: '0.96' },
background: { primary: '#faf8f0', secondary: '#f5f3e8' },
accentRgb: '46, 94, 138',
accent500: '#2e5e8a',
accent600: '#234a6d',
Expand All @@ -264,7 +215,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-china-night',
name: 'Ink Night',
type: 'dark',
background: { primary: '#1a1814', secondary: '#212019', tooltipRgb: '26, 24, 20' },
background: { primary: '#1a1814', secondary: '#212019' },
accentRgb: '115, 165, 204',
accent500: '#73a5cc',
accent600: '#5a8bb3',
Expand All @@ -278,7 +229,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-cyber',
name: 'Cyber',
type: 'dark',
background: { primary: '#0e0e10', secondary: '#151515', tooltipRgb: '14, 14, 16' },
background: { primary: '#0e0e10', secondary: '#151515' },
accentRgb: '0, 230, 255',
accent500: '#00e6ff',
accent600: '#00ccff',
Expand All @@ -292,7 +243,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-tokyo-night',
name: 'Tokyo Night',
type: 'dark',
background: { primary: '#1a1b26', secondary: '#16161e', tooltipRgb: '22, 22, 30', tooltipAlpha: '0.94' },
background: { primary: '#1a1b26', secondary: '#16161e' },
accentRgb: '122, 162, 247',
accent500: '#7aa2f7',
accent600: '#6183bb',
Expand All @@ -306,7 +257,7 @@ export const THEMES: InstallerTheme[] = [
id: 'bitfun-slate',
name: 'Slate',
type: 'dark',
background: { primary: '#1a1c1e', tooltipRgb: '42, 45, 48', tooltipAlpha: '0.96' },
background: { primary: '#1a1c1e' },
accentRgb: '122, 176, 238',
accent500: '#7ab0ee',
accent600: '#689ad8',
Expand Down
Loading
Loading