diff --git a/src/colors.js b/src/colors.js index 9deb092..f119445 100644 --- a/src/colors.js +++ b/src/colors.js @@ -1,32 +1,271 @@ -module.exports = { +// const { prefixKeys } = require("./utilities"); + +const base = { + current: "currentColor", black: "#000000", + transparent: "transparent", + white: "#ffffff", +}; + +const grays = { blue: { - 25: "#f5faff", - 50: "#eff8ff", - 100: "#d1e9ff", - 200: "#b2ddff", - 300: "#84caff", - 400: "#53b1fd", - 500: "#2e90fa", - 600: "#1570ef", - 700: "#175cd3", - 800: "#1849a9", - 900: "#194185", + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", }, - current: "currentColor", - cyan: { - 25: "#f5feff", - 50: "#ecfdff", - 100: "#cff9fe", - 200: "#a5f0fc", - 300: "#67e3f9", - 400: "#22ccee", - 500: "#06aed4", - 600: "#088ab2", - 700: "#0e7090", - 800: "#155b75", - 900: "#164c63", + cool: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + iron: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + modern: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + neutral: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + true: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + warm: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, +}; + +const krystal = { + indigo: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, + purple: { + 25: "", + 50: "", + 100: "", + 200: "", + 300: "", + 400: "", + 500: "", + 600: "", + 700: "", + 800: "", + 900: "", + }, +}; + +const primary = { + carbon: { + 25: "#fafbfc", + 50: "#f6f7f9", + 100: "#ebedf0", + 200: "#dbe0e6", + 300: "#c2cbd5", + 400: "#93a1b3", + 500: "#5e7086", + 600: "#4d5a6d", + 700: "#3e4856", + 800: "#282f38", + 900: "#182229", + }, + grass: { + 25: "#f7fdf7", + 50: "#effbef", + 100: "#dff9e0", + 200: "#c1f1c3", + 300: "#91e495", + 400: "#5ace60", + 500: "#34b33c", + 600: "#369c37", + 700: "#297e2a", + 800: "#225923", + 900: "#1d4a1f", + }, + midnight: { + 25: "#fbfcfe", + 50: "#f4f5fb", + 100: "#dbe2f0", + 200: "#c3cfe7", + 300: "#99add7", + 400: "#6382c0", + 500: "#4265a7", + 600: "#345395", + 700: "#243e68", + 800: "#1f2e4d", + 900: "#101828", + }, + moss: { + 25: "#f7fffd", + 50: "#eeffef9", + 100: "#c9feef", + 200: "#93fce0", + 300: "#55f3ce", + 400: "#23deb9", + 500: "#0ac2a0", + 600: "#069d84", + 700: "#058673", + 800: "#045e52", + 900: "#034f45", + }, + mustard: { + 25: "#fefcf5", + 50: "#fffaeb", + 100: "#fdefc8", + 200: "#fcdd8b", + 300: "#fac64f", + 400: "#f9af26", + 500: "#f3931b", + 600: "#d76808", + 700: "#b2470b", + 800: "#903710", + 900: "#772e10", + }, + palm: { + 25: "#f6fbf4", + 50: "#f0f9ec", + 100: "#dff1d6", + 200: "#c1e5b1", + 300: "#9ad383", + 400: "#67b848", + 500: "#5ea641", + 600: "#498831", + 700: "#3c6c29", + 800: "#325625", + 900: "#2a4720", + }, + sea: { + 25: "#f8fbff", + 50: "#f1f7fe", + 100: "#e2eefc", + 200: "#bfdaf8", + 300: "#87bcf2", + 400: "#479be9", + 500: "#1f7ed8", + 600: "#1262b7", + 700: "#1156a3", + 800: "#11447b", + 900: "#143a66", + }, + sky: { + 25: "#f8fbff", + 50: "#f1f7fe", + 100: "#e2eefc", + 200: "#bfdaf8", + 300: "#87bcf2", + 400: "#479be9", + 500: "#1f7ed8", + 600: "#1262b7", + 700: "#1156a3", + 800: "#11447b", + 900: "#143a66", + }, + sunshine: { + 25: "#fffdf0", + 50: "#fefce8", + 100: "#fff9c2", + 200: "#ffef88", + 300: "#ffde44", + 400: "#fec707", + 500: "#eeb004", + 600: "#cd8701", + 700: "#a45f04", + 800: "#874a0c", + 900: "#733d10", + }, + toucan: { + 25: "#fffbfa", + 50: "#fff3f1", + 100: "#ffe5e1", + 200: "#ffcec7", + 300: "#ffaba0", + 400: "#ff7c6a", + 500: "#f8513b", + 600: "#e8442e", + 700: "#c22813", + 800: "#a02514", + 900: "#842518", }, +}; + +const secondary = {}; + +const states = { error: { 25: "#fffbfa", 50: "#fef3f2", @@ -40,136 +279,6 @@ module.exports = { 800: "#912018", 900: "#7a271a", }, - fuchsia: { - 25: "#fefaff", - 50: "#fdf4ff", - 100: "#fbe8ff", - 200: "#f6d0fe", - 300: "#eeaafd", - 400: "#e478fa", - 500: "#d444f1", - 600: "#ba24d5", - 700: "#9f1ab1", - 800: "#821890", - 900: "#6f1877", - }, - gray: { - 25: "#fcfcfd", - 50: "#f9fafb", - 100: "#f2f4f7", - 200: "#eaecf0", - 300: "#d0d5dd", - 400: "#98a2b3", - 500: "#667085", - 600: "#475467", - 700: "#344054", - 800: "#1d2939", - 900: "#101828", - }, - green: { - 25: "#f6fef9", - 50: "#edfcf2", - 100: "#d3f8df", - 200: "#aaf0c4", - 300: "#73e2a3", - 400: "#3ccb7f", - 500: "#16b364", - 600: "#099250", - 700: "#087443", - 800: "#095c37", - 900: "#084c2e", - }, - indigo: { - 25: "#f9f9fd", - 50: "#f4f3fb", - 100: "#e5e3f6", - 200: "#d0cdf0", - 300: "#aeaae6", - 400: "#8982d8", - 500: "#7464cd", - 600: "#6248bc", - 700: "#493696", - 800: "#312468", - 900: "#220059", - }, - moss: { - 25: "#fafdf7", - 50: "#f5fbee", - 100: "#e6f4d7", - 200: "#ceeab0", - 300: "#acdc79", - 400: "#86cb3c", - 500: "#669f2a", - 600: "#4f7a21", - 700: "#3f621a", - 800: "#335015", - 900: "#2b4212", - }, - orange: { - 25: "#fefaf5", - 50: "#fef6ee", - 100: "#fdead7", - 200: "#f9dbaf", - 300: "#f7b27a", - 400: "#f38744", - 500: "#ef6820", - 600: "#e04f16", - 700: "#b93815", - 800: "#932f19", - 900: "#772917", - }, - pink: { - 25: "#fef6fb", - 50: "#fdf2fa", - 100: "#fce7f6", - 200: "#fcceee", - 300: "#faa7e0", - 400: "#f670c7", - 500: "#ee46bc", - 600: "#dd2590", - 700: "#c11574", - 800: "#9e165f", - 900: "#851651", - }, - primary: { - 25: "#f9f9fd", - 50: "#f4f3fb", - 100: "#e5e3f6", - 200: "#d0cdf0", - 300: "#aeaae6", - 400: "#8982d8", - 500: "#7464cd", - 600: "#6248bc", - 700: "#493696", - 800: "#312468", - 900: "#220059", - }, - purple: { - 25: "#fbfafe", - 50: "#f5f1ff", - 100: "#efe5ff", - 200: "#dfceff", - 300: "#c8a7ff", - 400: "#b076ff", - 500: "#9b3fff", - 600: "#9418ff", - 700: "#8807fa", - 800: "#7205d2", - 900: "#6707bb", - }, - rose: { - 25: "#fff5f6", - 50: "#fff1f3", - 100: "#ffe4e8", - 200: "#fecdd6", - 300: "#fea3b4", - 400: "#fd6f8e", - 500: "#f63d68", - 600: "#e31b54", - 700: "#c01048", - 800: "#a11043", - 900: "#89123e", - }, success: { 25: "#f6fef9", 50: "#ecfdf3", @@ -183,32 +292,6 @@ module.exports = { 800: "#05603a", 900: "#054f31", }, - teal: { - 25: "#f6fefc", - 50: "#f0fdf9", - 100: "#ccfbef", - 200: "#99f6e0", - 300: "#5fe9d0", - 400: "#2ed3b7", - 500: "#15b79e", - 600: "#0e9384", - 700: "#107569", - 800: "#125d56", - 900: "#134e48", - }, - violet: { - 25: "#fbfaff", - 50: "#f5f3ff", - 100: "#ece9fe", - 200: "#ddd6fe", - 300: "#c3b5fd", - 400: "#a48afb", - 500: "#875bf7", - 600: "#7839ee", - 700: "#6927da", - 800: "#5720b7", - 900: "#491c96", - }, warning: { 25: "#fffcf5", 50: "#fffaeb", @@ -222,19 +305,13 @@ module.exports = { 800: "#93370d", 900: "#7a2e0e", }, - yellow: { - 25: "#fefdf0", - 50: "#fefbe8", - 100: "#fef7c3", - 200: "#feee95", - 300: "#fde272", - 400: "#fac515", - 500: "#eaaa08", - 600: "#ca8504", - 700: "#a15c07", - 800: "#854a0e", - 900: "#713b12", - }, - transparent: "transparent", - white: "#ffffff", +}; + +module.exports = { + ...base, + // ...prefixKeys(grays, "gray"), + // ...prefixKeys(krystal, "krystal"), + ...primary, + // ...secondary, + ...states, }; diff --git a/src/index.js b/src/index.js index 8eacdcd..1068c56 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,9 @@ const path = require("path"); const tailwindColors = require("tailwindcss/colors"); -const tailwindDefaultTheme = require("tailwindcss/defaultTheme"); const { withOptions } = require("tailwindcss/plugin"); const colors = require("./colors"); +const typography = require("./typography"); const { getShardContentPaths, getShardPath } = require("./utilities"); const TAILWIND_DEPRECATED_COLORS = Object.freeze([ @@ -31,7 +31,7 @@ const plugin = withOptions( }, function (options = {}) { const defaultColors = options.defaultColors ?? false; - const primaryColor = options.primaryColor ?? "indigo"; + const primaryColor = options.primaryColor ?? "carbon"; const colorsObject = { ...(defaultColors @@ -47,6 +47,7 @@ const plugin = withOptions( ) : {}), ...colors, + gray: colors.carbon, primary: colors[primaryColor], }; @@ -67,66 +68,7 @@ const plugin = withOptions( ], theme: { colors: colorsObject, - fontSize: { - ...["sm", "base", "lg"].reduce( - (object, size) => ({ - ...object, - [size]: tailwindDefaultTheme.fontSize[size], - }), - {} - ), - xs: [ - "0.75rem", - { - lineHeight: "1.125rem", - }, - ], - sm: [ - "0.875rem", - { - lineHeight: "1.5rem", - }, - ], - "h-xs": [ - "1.25rem", - { - lineHeight: "1.75rem", - }, - ], - "h-sm": [ - "1.5rem", - { - lineHeight: "2rem", - }, - ], - "h-md": [ - "1.875rem", - { - lineHeight: "2.375rem", - }, - ], - "h-lg": [ - "2.25rem", - { - letterSpacing: "-0.02em", - lineHeight: "2.75rem", - }, - ], - "h-xl": [ - "3rem", - { - letterSpacing: "-0.02em", - lineHeight: "3.75rem", - }, - ], - "h-2xl": [ - "3.75rem", - { - letterSpacing: "-0.02em", - lineHeight: "4.5rem", - }, - ], - }, + fontSize: typography, extend: { spacing: { 4.5: "1.125.rem", diff --git a/src/typography.js b/src/typography.js new file mode 100644 index 0000000..eb969fd --- /dev/null +++ b/src/typography.js @@ -0,0 +1,63 @@ +const { fontSize } = require("tailwindcss/defaultTheme"); + +module.exports = { + ...["sm", "base", "lg"].reduce( + (object, size) => ({ + ...object, + [size]: fontSize[size], + }), + {} + ), + xs: [ + "0.75rem", + { + lineHeight: "1.125rem", + }, + ], + sm: [ + "0.875rem", + { + lineHeight: "1.5rem", + }, + ], + md: fontSize.base, + "h-xs": [ + "1.25rem", + { + lineHeight: "1.75rem", + }, + ], + "h-sm": [ + "1.5rem", + { + lineHeight: "2rem", + }, + ], + "h-md": [ + "1.875rem", + { + lineHeight: "2.375rem", + }, + ], + "h-lg": [ + "2.25rem", + { + letterSpacing: "-0.02em", + lineHeight: "2.75rem", + }, + ], + "h-xl": [ + "3rem", + { + letterSpacing: "-0.02em", + lineHeight: "3.75rem", + }, + ], + "h-2xl": [ + "3.75rem", + { + letterSpacing: "-0.02em", + lineHeight: "4.5rem", + }, + ], +}; diff --git a/src/utilities.js b/src/utilities.js index 1e2786d..6663c3f 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -15,7 +15,23 @@ const getShardPath = () => } ).trim(); +const prefixKey = (key, prefix) => [prefix, titleize(key)].join(""); + +const prefixKeys = (palettes, prefix) => + palettes.reduce((o, [k, v]) => { + return { + ...o, + [prefixedKey(k, prefix)]: v, + }; + }, {}); + +const titleize = (string) => + `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`; + module.exports = { getShardContentPaths, getShardPath, + prefixKey, + prefixKeys, + titleize, };