Customizing Colors

Customizing the default color palette for your project.

Palette Reference

xstyled includes Tailwind colors as a default palette that is a great starting point if you don't have your own specific branding in mind.

Blue Gray
colors.blue-gray
50
#f8fafcff
100
#f1f5f9ff
200
#e2e8f0ff
300
#cbd5e1ff
400
#94a3b8ff
500
#64748bff
600
#475569ff
700
#334155ff
800
#1e293bff
900
#0f172aff
Cool Gray
colors.cool-gray
50
#f9fafbff
100
#f3f4f6ff
200
#e5e7ebff
300
#d1d5dbff
400
#9ca3afff
500
#6b7280ff
600
#4b5563ff
700
#374151ff
800
#1f2937ff
900
#111827ff
Gray
colors.gray
50
#fafafaff
100
#f4f4f5ff
200
#e4e4e7ff
300
#d4d4d8ff
400
#a1a1aaff
500
#71717aff
600
#52525bff
700
#3f3f46ff
800
#27272aff
900
#18181bff
True Gray
colors.true-gray
50
#fafafaff
100
#f5f5f5ff
200
#e5e5e5ff
300
#d4d4d4ff
400
#a3a3a3ff
500
#737373ff
600
#525252ff
700
#404040ff
800
#262626ff
900
#171717ff
Warm Gray
colors.warm-gray
50
#fafaf9ff
100
#f5f5f4ff
200
#e7e5e4ff
300
#d6d3d1ff
400
#a8a29eff
500
#78716cff
600
#57534eff
700
#44403cff
800
#292524ff
900
#1c1917ff
Red
colors.red
50
#fef2f2ff
100
#fee2e2ff
200
#fecacaff
300
#fca5a5ff
400
#f87171ff
500
#ef4444ff
600
#dc2626ff
700
#b91c1cff
800
#991b1bff
900
#7f1d1dff
Orange
colors.orange
50
#fff7edff
100
#ffedd5ff
200
#fed7aaff
300
#fdba74ff
400
#fb923cff
500
#f97316ff
600
#ea580cff
700
#c2410cff
800
#9a3412ff
900
#7c2d12ff
Amber
colors.amber
50
#fffbebff
100
#fef3c7ff
200
#fde68aff
300
#fcd34dff
400
#fbbf24ff
500
#f59e0bff
600
#d97706ff
700
#b45309ff
800
#92400eff
900
#78350fff
Yellow
colors.yellow
50
#fefce8ff
100
#fef9c3ff
200
#fef08aff
300
#fde047ff
400
#facc15ff
500
#eab308ff
600
#ca8a04ff
700
#a16207ff
800
#854d0eff
900
#713f12ff
Lime
colors.lime
50
#f7fee7ff
100
#ecfccbff
200
#d9f99dff
300
#bef264ff
400
#a3e635ff
500
#84cc16ff
600
#65a30dff
700
#4d7c0fff
800
#3f6212ff
900
#365314ff
Green
colors.green
50
#f0fdf4ff
100
#dcfce7ff
200
#bbf7d0ff
300
#86efacff
400
#4ade80ff
500
#22c55eff
600
#16a34aff
700
#15803dff
800
#166534ff
900
#14532dff
Emerald
colors.emerald
50
#ecfdf5ff
100
#d1fae5ff
200
#a7f3d0ff
300
#6ee7b7ff
400
#34d399ff
500
#10b981ff
600
#059669ff
700
#047857ff
800
#065f46ff
900
#064e3bff
Teal
colors.teal
50
#f0fdfaff
100
#ccfbf1ff
200
#99f6e4ff
300
#5eead4ff
400
#2dd4bfff
500
#14b8a6ff
600
#0d9488ff
700
#0f766eff
800
#115e59ff
900
#134e4aff
Cyan
colors.cyan
50
#ecfeffff
100
#cffafeff
200
#a5f3fcff
300
#67e8f9ff
400
#22d3eeff
500
#06b6d4ff
600
#0891b2ff
700
#0e7490ff
800
#155e75ff
900
#164e63ff
Light Blue
colors.light-blue
50
#f0f9ffff
100
#e0f2feff
200
#bae6fdff
300
#7dd3fcff
400
#38bdf8ff
500
#0ea5e9ff
600
#0284c7ff
700
#0369a1ff
800
#075985ff
900
#0c4a6eff
Blue
colors.blue
50
#eff6ffff
100
#dbeafeff
200
#bfdbfeff
300
#93c5fdff
400
#60a5faff
500
#3b82f6ff
600
#2563ebff
700
#1d4ed8ff
800
#1e40afff
900
#1e3a8aff
Indigo
colors.indigo
50
#eef2ffff
100
#e0e7ffff
200
#c7d2feff
300
#a5b4fcff
400
#818cf8ff
500
#6366f1ff
600
#4f46e5ff
700
#4338caff
800
#3730a3ff
900
#312e81ff
Violet
colors.violet
50
#f5f3ffff
100
#ede9feff
200
#ddd6feff
300
#c4b5fdff
400
#a78bfaff
500
#8b5cf6ff
600
#7c3aedff
700
#6d28d9ff
800
#5b21b6ff
900
#4c1d95ff
Purple
colors.purple
50
#faf5ffff
100
#f3e8ffff
200
#e9d5ffff
300
#d8b4feff
400
#c084fcff
500
#a855f7ff
600
#9333eaff
700
#7e22ceff
800
#6b21a8ff
900
#581c87ff
Fuchsia
colors.fuchsia
50
#fdf4ffff
100
#fae8ffff
200
#f5d0feff
300
#f0abfcff
400
#e879f9ff
500
#d946efff
600
#c026d3ff
700
#a21cafff
800
#86198fff
900
#701a75ff
Pink
colors.pink
50
#fdf2f8ff
100
#fce7f3ff
200
#fbcfe8ff
300
#f9a8d4ff
400
#f472b6ff
500
#ec4899ff
600
#db2777ff
700
#be185dff
800
#9d174dff
900
#831843ff
Rose
colors.rose
50
#fff1f2ff
100
#ffe4e6ff
200
#fecdd3ff
300
#fda4afff
400
#fb7185ff
500
#f43f5eff
600
#e11d48ff
700
#be123cff
800
#9f1239ff
900
#881337ff

Alpha Variants

All colors includes 10 degrees of alpha variants, for example you can use red-500-a50 to display a red-500 color with an opacity of 0.5.

<x.p color="red-500-a50" />

Add colors

Even if the included palette is large, feel free to add your own colors.

import { defaultTheme } from '@xstyled/...' export const theme = { colors: { ...defaultTheme.colors, 'blue-light': '#85d7ff', }, }

Alpha variants are not automatically generated. To get it, you have to use generateHexAlphaVariants utility.

import { defaultTheme, generateHexAlphaVariants } from '@xstyled/...' export const theme = { colors: { ...defaultTheme.colors, // Generate 'blue-light-a10', 'blue-light-a20', ... ...generateHexAlphaVariants({ 'blue-light': '#85d7ff', }), }, }

Alias Colors

It is always a good choice to alias colors, for example define a primary that refers to emerald.

import { defaultTheme, aliasColor } from '@xstyled/...' export const theme = { colors: { ...defaultTheme.colors, // Using `primary-500` is equivalent to `emerald-500` ...aliasColor('primary', 'emerald'), }, }
Edit this page on GitHub