深灰背景、紫藍強調色與微光邊框,營造專注、高效率的生產力工具氛圍。
Preview
使用 Linear token 打造的範例元件。
Card
radius-lg · shadow-md
background
#08090a
foreground
#f7f8f8
gray-100
#1c1c1f
gray-200
#23252a
gray-400
#62666d
gray-600
#8a8f98
gray-900
#d0d6e0
border
rgba(255, 255, 255, 0.08)
primary
#5e6ad2
primary-foreground
#ffffff
accent
#7170ff
success
#4cb782
warning
#f2c94c
error
#eb5757
// =============================================
// Linear Style Tokens — _tokens.scss
// 深色模式・冷靜精準
// =============================================
// ---------- Colors ----------
$color-background: #08090a;
$color-foreground: #f7f8f8;
$color-gray-100: #1c1c1f;
$color-gray-200: #23252a;
$color-gray-400: #62666d;
$color-gray-600: #8a8f98;
$color-gray-900: #d0d6e0;
$color-border: rgba(255, 255, 255, 0.08);
$color-primary: #5e6ad2;
$color-primary-foreground: #ffffff;
$color-accent: #7170ff;
$color-success: #4cb782;
$color-warning: #f2c94c;
$color-error: #eb5757;
// ---------- Typography ----------
$font-sans: "Inter Variable", "Inter", -apple-system, sans-serif;
$font-mono: "Berkeley Mono", "JetBrains Mono", monospace;
$font-size-xs: 12px;
$font-size-sm: 13px;
$font-size-base: 15px;
$font-size-lg: 17px;
$font-size-xl: 21px;
$font-size-2xl: 32px;
$font-size-3xl: 56px;
$font-weight-regular: 400;
$font-weight-medium: 510;
$font-weight-semibold: 590;
$font-weight-bold: 680;
// ---------- Radius ----------
$radius-sm: 4px;
$radius-md: 6px;
$radius-lg: 8px;
$radius-xl: 12px;
$radius-full: 9999px;
// ---------- Spacing ----------
$space-0: 0;
$space-1: 4px;
$space-2: 8px;
$space-3: 12px;
$space-4: 16px;
$space-5: 24px;
$space-6: 32px;
$space-7: 48px;
$space-8: 64px;
// ---------- Shadows ----------
$shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
$shadow-md: 0 4px 24px rgba(0, 0, 0, 0.5);
$shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 48px rgba(0, 0, 0, 0.6);
// ---------- Motion ----------
$duration: 160ms;
$easing: cubic-bezier(0.16, 1, 0.3, 1);
// ---------- Maps ----------
$colors: (
"background": $color-background,
"foreground": $color-foreground,
"gray-100": $color-gray-100,
"gray-200": $color-gray-200,
"gray-400": $color-gray-400,
"gray-600": $color-gray-600,
"gray-900": $color-gray-900,
"border": $color-border,
"primary": $color-primary,
"primary-foreground": $color-primary-foreground,
"accent": $color-accent,
"success": $color-success,
"warning": $color-warning,
"error": $color-error,
);
$font-sizes: (
"xs": $font-size-xs,
"sm": $font-size-sm,
"base": $font-size-base,
"lg": $font-size-lg,
"xl": $font-size-xl,
"2xl": $font-size-2xl,
"3xl": $font-size-3xl,
);
$radii: (
"sm": $radius-sm,
"md": $radius-md,
"lg": $radius-lg,
"xl": $radius-xl,
"full": $radius-full,
);
$spaces: (
"0": $space-0,
"1": $space-1,
"2": $space-2,
"3": $space-3,
"4": $space-4,
"5": $space-5,
"6": $space-6,
"7": $space-7,
"8": $space-8,
);
$shadows: (
"sm": $shadow-sm,
"md": $shadow-md,
"lg": $shadow-lg,
);
// ---------- Helpers ----------
@function color($name) {
@return map-get($colors, $name);
}
@function space($step) {
@return map-get($spaces, $step);
}
// 將所有 token 輸出為 CSS 自訂屬性
:root {
@each $name, $value in $colors {
--color-#{$name}: #{$value};
}
@each $name, $value in $font-sizes {
--font-size-#{$name}: #{$value};
}
@each $name, $value in $radii {
--radius-#{$name}: #{$value};
}
@each $name, $value in $spaces {
--space-#{$name}: #{$value};
}
@each $name, $value in $shadows {
--shadow-#{$name}: #{$value};
}
--font-sans: #{$font-sans};
--font-mono: #{$font-mono};
}
// ---------- Mixins ----------
@mixin button-primary {
display: inline-flex;
align-items: center;
gap: $space-2;
padding: $space-2 $space-4;
font-family: $font-sans;
font-size: $font-size-sm;
font-weight: $font-weight-medium;
color: $color-primary-foreground;
background: $color-primary;
border: 0;
border-radius: $radius-md;
transition: opacity $duration $easing;
&:hover {
opacity: 0.85;
}
}
@mixin card {
padding: $space-5;
background: $color-background;
border: 1px solid $color-border;
border-radius: $radius-lg;
box-shadow: $shadow-sm;
}