HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="flex sm:flex-row flex-col items-center sm:items-start sm:justify-between m-4">
<div>
<div class="grid gap-4 m-4 grid-cols-6">
<div class="grid gap-2">
<div class="">Value</div>
<div class="h-8">100</div>
<div class="h-8">200</div>
<div class="h-8">300</div>
<div class="h-8">400</div>
<div class="h-8">500</div>
<div class="h-8">600</div>
<div class="h-8">700</div>
<div class="h-8">800</div>
<div class="h-8">900</div>
</div>
<div class="grid gap-2">
Gray
<div class="h-8 w-8 bg-gray-100 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-200 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-300 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-400 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-500 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-600 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-700 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-800 shadow-md rounded"></div>
<div class="h-8 w-8 bg-gray-900 shadow-md rounded"></div>
</div>
<div class="grid gap-2">
Brand
<div class="h-8 w-8 bg-brand-100 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-200 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-300 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-400 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-500 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-600 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-700 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-800 shadow-md rounded"></div>
<div class="h-8 w-8 bg-brand-900 shadow-md rounded"></div>
</div>
<div class="grid gap-2">
Confirm
<div class="h-8 w-8 bg-confirm-100 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-200 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-300 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-400 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-500 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-600 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-700 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-800 shadow-md rounded"></div>
<div class="h-8 w-8 bg-confirm-900 shadow-md rounded"></div>
</div>
<div class="grid gap-2">
Danger
<div class="h-8 w-8 bg-danger-100 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-200 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-300 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-400 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-500 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-600 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-700 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-800 shadow-md rounded"></div>
<div class="h-8 w-8 bg-danger-900 shadow-md rounded"></div>
</div>
<div class="grid gap-2">
Warning
<div class="h-8 w-8 bg-warning-100 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-200 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-300 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-400 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-500 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-600 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-700 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-800 shadow-md rounded"></div>
<div class="h-8 w-8 bg-warning-900 shadow-md rounded"></div>
</div>
</div>
<div class="m-4 p-4 flex items-center text-warning-700 bg-warning-100 border-warning-400 border rounded-lg shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
Example warning
</div>
<div class="m-4 p-4 flex items-center text-danger-700 bg-danger-100 border-danger-400 border rounded-lg shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
Example error
</div>
<div class="m-4 p-4 flex items-center text-brand-700 bg-brand-100 border-brand-400 border rounded-lg shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
Example info
</div>
<div class="m-4 p-4 flex items-center text-confirm-700 bg-confirm-100 border-confirm-400 border rounded-lg shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
</svg>
Example confirmation
</div>
<button class="m-4 button">
Button
</button>
<button class="m-4 button button-confirm">
Confirm
</button>
<button class="m-4 button button-danger">
Delete
</button>
<button class="m-4 button button-gray">
Search
</button>
<button class="m-4 button button-secondary">
Log in
</button>
<button class="m-4 button button-plain">
Cancel
</button>
</div>
<div class="order-first sm:order-last">
<div class="mt-4 flex flex-col items-center">
<div class="flex items-center gap-2">
Brand color value <input class="mx-auto" type="color" id="usr-clr" oninput="getColor()">
</div>
</div>
<div class="mt-12 mx-auto flex flex-col items-center gap-2">
<div class="flex items-center gap-2">
100 <input class="range-100" id="rangeOneHundred" type="range" min="0" max="1" step=".01" value="0.92" oninput="rangeOneHundredOutput.value = rangeOneHundred.value"> <output id="rangeOneHundredOutput" class="w-8">0.92</output>
</div>
<div class="flex items-center gap-2">
200 <input class="range-200" id="rangeTwoHundred" type="range" min="0" max="1" step=".01" value="0.86" oninput="rangeTwoHundredOutput.value = rangeTwoHundred.value"> <output id="rangeTwoHundredOutput" class="w-8">0.86</output>
</div>
<div class="flex items-center gap-2">
300 <input class="range-300" id="rangeThreeHundred" type="range" min="0" max="1" step=".01" value="0.65" oninput="rangeThreeHundredOutput.value = rangeThreeHundred.value"> <output id="rangeThreeHundredOutput" class="w-8">0.65</output>
</div>
<div class="flex items-center gap-2">
400 <input class="range-400" id="rangeFourHundred" type="range" min="0" max="1" step=".01" value="0.21" oninput="rangeFourHundredOutput.value = rangeFourHundred.value"> <output id="rangeFourHundredOutput" class="w-8">0.21</output>
</div>
<div class="flex items-center gap-2">
600 <input class="range-600" id="rangeSixHundred" type="range" min="0" max="1" step=".01" value="0.17" oninput="rangeSixHundredOutput.value = rangeSixHundred.value"> <output id="rangeSixHundredOutput" class="w-8">0.17</output>
</div>
<div class="flex items-center gap-2">
700 <input class="range-700" id="rangeSevenHundred" type="range" min="0" max="1" step=".01" value="0.29" oninput="rangeSevenHundredOutput.value = rangeSevenHundred.value"> <output id="rangeSevenHundredOutput" class="w-8">0.29</output>
</div>
<div class="flex items-center gap-2">
800 <input class="range-800" id="rangeEightHundred" type="range" min="0" max="1" step=".01" value="0.4" oninput="rangeEightHundredOutput.value = rangeEightHundred.value"> <output id="rangeEightHundredOutput" class="w-8">0.4</output>
</div>
<div class="flex items-center gap-2">
900 <input class="range-900" id="rangeNineHundred" type="range" min="0" max="1" step=".01" value="0.57" oninput="rangeNineHundredOutput.value = rangeNineHundred.value"> <output id="rangeNineHundredOutput" class="w-8">0.57</output>
</div>
</div>
</div>
</div>
:root {
--step-100-value: 0.92;
--step-200-value: 0.86;
--step-300-value: 0.65;
--step-400-value: 0.21;
--step-600-value: 0.17;
--step-700-value: 0.29;
--step-800-value: 0.4;
--step-900-value: 0.57;
/* Brand theme configuration */
--theme-brand-h: 201;
--theme-brand-s: 70%;
--theme-brand-l: 40%;
--theme-brand-900: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) - calc(var(--theme-brand-l) * var(--step-900-value))
)
);
--theme-brand-800: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) - calc(var(--theme-brand-l) * var(--step-800-value))
)
);
--theme-brand-700: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) - calc(var(--theme-brand-l) * var(--step-700-value))
)
);
--theme-brand-600: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) - calc(var(--theme-brand-l) * var(--step-600-value))
)
);
--theme-brand-500: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
var(--theme-brand-l)
);
--theme-brand-400: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) +
calc(calc(100% - var(--theme-brand-l)) * var(--step-400-value))
)
);
--theme-brand-300: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) +
calc(calc(100% - var(--theme-brand-l)) * var(--step-300-value))
)
);
--theme-brand-200: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) +
calc(calc(100% - var(--theme-brand-l)) * var(--step-200-value))
)
);
--theme-brand-100: hsl(
var(--theme-brand-h),
var(--theme-brand-s),
calc(
var(--theme-brand-l) +
calc(calc(100% - var(--theme-brand-l)) * var(--step-100-value))
)
);
--theme-brand-500-25: hsla(
var(--theme-brand-h),
var(--theme-brand-s),
var(--theme-brand-l),
0.25
);
/* Danger theme configuration */
--theme-danger-h: 7;
--theme-danger-s: 72%;
--theme-danger-l: 65%;
--theme-danger-900: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) -
calc(var(--theme-danger-l) * var(--step-900-value))
)
);
--theme-danger-800: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) -
calc(var(--theme-danger-l) * var(--step-800-value))
)
);
--theme-danger-700: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) -
calc(var(--theme-danger-l) * var(--step-700-value))
)
);
--theme-danger-600: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) -
calc(var(--theme-danger-l) * var(--step-600-value))
)
);
--theme-danger-500: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
var(--theme-danger-l)
);
--theme-danger-400: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) +
calc(calc(100% - var(--theme-danger-l)) * var(--step-400-value))
)
);
--theme-danger-300: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) +
calc(calc(100% - var(--theme-danger-l)) * var(--step-300-value))
)
);
--theme-danger-200: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) +
calc(calc(100% - var(--theme-danger-l)) * var(--step-200-value))
)
);
--theme-danger-100: hsl(
var(--theme-danger-h),
var(--theme-danger-s),
calc(
var(--theme-danger-l) +
calc(calc(100% - var(--theme-danger-l)) * var(--step-100-value))
)
);
--theme-danger-500-25: hsla(
var(--theme-danger-h),
var(--theme-danger-s),
var(--theme-danger-l),
0.25
);
/* Confirm theme configuration */
--theme-confirm-h: 150;
--theme-confirm-s: 40%;
--theme-confirm-l: 57%;
--theme-confirm-900: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) -
calc(var(--theme-confirm-l) * var(--step-900-value))
)
);
--theme-confirm-800: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) -
calc(var(--theme-confirm-l) * var(--step-800-value))
)
);
--theme-confirm-700: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) -
calc(var(--theme-confirm-l) * var(--step-700-value))
)
);
--theme-confirm-600: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) -
calc(var(--theme-confirm-l) * var(--step-600-value))
)
);
--theme-confirm-500: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
var(--theme-confirm-l)
);
--theme-confirm-400: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) +
calc(calc(100% - var(--theme-confirm-l)) * var(--step-400-value))
)
);
--theme-confirm-300: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) +
calc(calc(100% - var(--theme-confirm-l)) * var(--step-300-value))
)
);
--theme-confirm-200: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) +
calc(calc(100% - var(--theme-confirm-l)) * var(--step-200-value))
)
);
--theme-confirm-100: hsl(
var(--theme-confirm-h),
var(--theme-confirm-s),
calc(
var(--theme-confirm-l) +
calc(calc(100% - var(--theme-confirm-l)) * var(--step-100-value))
)
);
--theme-confirm-500-25: hsla(
var(--theme-confirm-h),
var(--theme-confirm-s),
var(--theme-confirm-l),
0.25
);
/* Warning theme configuration */
--theme-warning-h: 41;
--theme-warning-s: 69%;
--theme-warning-l: 68%;
--theme-warning-900: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) -
calc(var(--theme-warning-l) * var(--step-900-value))
)
);
--theme-warning-800: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) -
calc(var(--theme-warning-l) * var(--step-800-value))
)
);
--theme-warning-700: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) -
calc(var(--theme-warning-l) * var(--step-700-value))
)
);
--theme-warning-600: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) -
calc(var(--theme-warning-l) * var(--step-600-value))
)
);
--theme-warning-500: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
var(--theme-warning-l)
);
--theme-warning-400: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) +
calc(calc(100% - var(--theme-warning-l)) * var(--step-400-value))
)
);
--theme-warning-300: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) +
calc(calc(100% - var(--theme-warning-l)) * var(--step-300-value))
)
);
--theme-warning-200: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) +
calc(calc(100% - var(--theme-warning-l)) * var(--step-200-value))
)
);
--theme-warning-100: hsl(
var(--theme-warning-h),
var(--theme-warning-s),
calc(
var(--theme-warning-l) +
calc(calc(100% - var(--theme-warning-l)) * var(--step-100-value))
)
);
--theme-warning-500-25: hsla(
var(--theme-warning-h),
var(--theme-warning-s),
var(--theme-warning-l),
0.25
);
/* Gray theme configuration */
--theme-gray-h: 0;
--theme-gray-s: 0%;
--theme-gray-l: 57%;
--theme-gray-900: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) - calc(var(--theme-gray-l) * var(--step-900-value))
)
);
--theme-gray-800: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) - calc(var(--theme-gray-l) * var(--step-800-value))
)
);
--theme-gray-700: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) - calc(var(--theme-gray-l) * var(--step-700-value))
)
);
--theme-gray-600: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) - calc(var(--theme-gray-l) * var(--step-600-value))
)
);
--theme-gray-500: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
var(--theme-gray-l)
);
--theme-gray-400: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) +
calc(calc(100% - var(--theme-gray-l)) * var(--step-400-value))
)
);
--theme-gray-300: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) +
calc(calc(100% - var(--theme-gray-l)) * var(--step-300-value))
)
);
--theme-gray-200: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) +
calc(calc(100% - var(--theme-gray-l)) * var(--step-200-value))
)
);
--theme-gray-100: hsl(
var(--theme-gray-h),
var(--theme-gray-s),
calc(
var(--theme-gray-l) +
calc(calc(100% - var(--theme-gray-l)) * var(--step-100-value))
)
);
--theme-gray-500-25: hsla(
var(--theme-gray-h),
var(--theme-gray-s),
var(--theme-gray-l),
0.25
);
/* Base configuration */
--theme-body-font-family: Avenir, sans-serif;
--theme-body-font-size: 16px;
--theme-body-background-color: #f9f8f7;
--theme-form-size: 2.5rem;
--theme-form-size--sm: 2rem;
--theme-form-size--lg: 3.5rem;
--theme-form-focus-ring: 0 0 0 0.25rem var(--theme-primary-400-025);
/* Button configuration */
--theme-button-border-radius: 0.5rem;
--theme-button-border-width: 0;
--theme-button-font: inherit;
--theme-button-padding: 0 1rem;
--theme-button-box-shadow: 0 0.125rem 0.3125rem 0 rgba(0, 0, 0, 0.03),
0 0.3125rem 1rem 0 rgba(0, 0, 0, 0.04);
--theme-button-box-shadow--lg: 0 1.75rem 2.8125rem rgba(0, 0, 0, 0.07),
0 0.5rem 0.875rem rgba(0, 0, 0, 0.045),
0 0.25rem 0.375rem rgba(0, 0, 0, 0.035),
0 0.125rem 0.25rem rgba(0, 0, 0, 0.025);
--theme-button-border-radius--lg: 40rem;
/* Input configuration */
--theme-input-border-radius: 0.5rem;
--theme-input-font: inherit;
--theme-input-padding: 0 0.6rem;
--theme-input-box-shadow: 0 0.125rem 0.3125rem 0 rgba(0, 0, 0, 0.03),
0 0.3125rem 1rem 0 rgba(0, 0, 0, 0.04);
--theme-input-border-color: #ccc;
--theme-input-border-width: 1px;
--theme-input-background-color: #fff;
--theme-input-color: #35444f;
--theme-input-placeholder-color: #bfbfbf;
--theme-textarea-padding: 0.6rem;
--theme-checkbox-box-shadow: 0 0.275rem 0.175rem 0 rgba(0, 0, 0, 0.02) inset,
0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.05) inset,
0 0.125rem 0.3125rem 0 rgba(0, 0, 0, 0.03),
0 0.3125rem 1rem 0 rgba(0, 0, 0, 0.04);
/* Icon configuration */
--theme-icon-stroke-width: 2;
--theme-icon-stroke-linecap: round;
--theme-icon-stroke-linejoin: round;
}
html {
font-size: var(--theme-body-font-size);
}
body {
background-color: var(--theme-body-background-color);
font-family: var(--theme-body-font-family);
}
.bg-brand-900 {
background-color: var(--theme-brand-900);
}
.bg-brand-800 {
background-color: var(--theme-brand-800);
}
.bg-brand-700 {
background-color: var(--theme-brand-700);
}
.bg-brand-600 {
background-color: var(--theme-brand-600);
}
.bg-brand-500 {
background-color: var(--theme-brand-500);
}
.bg-brand-400 {
background-color: var(--theme-brand-400);
}
.bg-brand-300 {
background-color: var(--theme-brand-300);
}
.bg-brand-200 {
background-color: var(--theme-brand-200);
}
.bg-brand-100 {
background-color: var(--theme-brand-100);
}
.bg-brand-50 {
background-color: var(--theme-brand-50);
}
.border-brand-900 {
border-color: var(--theme-brand-900);
}
.border-brand-800 {
border-color: var(--theme-brand-800);
}
.border-brand-700 {
border-color: var(--theme-brand-700);
}
.border-brand-600 {
border-color: var(--theme-brand-600);
}
.border-brand-500 {
border-color: var(--theme-brand-500);
}
.border-brand-400 {
border-color: var(--theme-brand-400);
}
.border-brand-300 {
border-color: var(--theme-brand-300);
}
.border-brand-200 {
border-color: var(--theme-brand-200);
}
.border-brand-100 {
border-color: var(--theme-brand-100);
}
.border-brand-50 {
border-color: var(--theme-brand-50);
}
.text-brand-900 {
color: var(--theme-brand-900);
}
.text-brand-800 {
color: var(--theme-brand-800);
}
.text-brand-700 {
color: var(--theme-brand-700);
}
.text-brand-600 {
color: var(--theme-brand-600);
}
.text-brand-500 {
color: var(--theme-brand-500);
}
.text-brand-400 {
color: var(--theme-brand-400);
}
.text-brand-300 {
color: var(--theme-brand-300);
}
.text-brand-200 {
color: var(--theme-brand-200);
}
.text-brand-100 {
color: var(--theme-brand-100);
}
.text-brand-50 {
color: var(--theme-brand-50);
}
.ring-brand,
.focus\:ring-brand:focus {
box-shadow: 0 0 0 0.25rem var(--theme-brand-400-25);
}
.bg-confirm-900 {
background-color: var(--theme-confirm-900);
}
.bg-confirm-800 {
background-color: var(--theme-confirm-800);
}
.bg-confirm-700 {
background-color: var(--theme-confirm-700);
}
.bg-confirm-600 {
background-color: var(--theme-confirm-600);
}
.bg-confirm-500 {
background-color: var(--theme-confirm-500);
}
.bg-confirm-400 {
background-color: var(--theme-confirm-400);
}
.bg-confirm-300 {
background-color: var(--theme-confirm-300);
}
.bg-confirm-200 {
background-color: var(--theme-confirm-200);
}
.bg-confirm-100 {
background-color: var(--theme-confirm-100);
}
.bg-confirm-50 {
background-color: var(--theme-confirm-50);
}
.border-confirm-900 {
border-color: var(--theme-confirm-900);
}
.border-confirm-800 {
border-color: var(--theme-confirm-800);
}
.border-confirm-700 {
border-color: var(--theme-confirm-700);
}
.border-confirm-600 {
border-color: var(--theme-confirm-600);
}
.border-confirm-500 {
border-color: var(--theme-confirm-500);
}
.border-confirm-400 {
border-color: var(--theme-confirm-400);
}
.border-confirm-300 {
border-color: var(--theme-confirm-300);
}
.border-confirm-200 {
border-color: var(--theme-confirm-200);
}
.border-confirm-100 {
border-color: var(--theme-confirm-100);
}
.border-confirm-50 {
border-color: var(--theme-confirm-50);
}
.text-confirm-900 {
color: var(--theme-confirm-900);
}
.text-confirm-800 {
color: var(--theme-confirm-800);
}
.text-confirm-700 {
color: var(--theme-confirm-700);
}
.text-confirm-600 {
color: var(--theme-confirm-600);
}
.text-confirm-500 {
color: var(--theme-confirm-500);
}
.text-confirm-400 {
color: var(--theme-confirm-400);
}
.text-confirm-300 {
color: var(--theme-confirm-300);
}
.text-confirm-200 {
color: var(--theme-confirm-200);
}
.text-confirm-100 {
color: var(--theme-confirm-100);
}
.text-confirm-50 {
color: var(--theme-confirm-50);
}
.ring-theme-confirm,
.focus\:ring-theme-confirm:focus {
box-shadow: 0 0 0 4px var(--theme-confirm-400-25);
}
.bg-warning-900 {
background-color: var(--theme-warning-900);
}
.bg-warning-800 {
background-color: var(--theme-warning-800);
}
.bg-warning-700 {
background-color: var(--theme-warning-700);
}
.bg-warning-600 {
background-color: var(--theme-warning-600);
}
.bg-warning-500 {
background-color: var(--theme-warning-500);
}
.bg-warning-400 {
background-color: var(--theme-warning-400);
}
.bg-warning-300 {
background-color: var(--theme-warning-300);
}
.bg-warning-200 {
background-color: var(--theme-warning-200);
}
.bg-warning-100 {
background-color: var(--theme-warning-100);
}
.bg-warning-50 {
background-color: var(--theme-warning-50);
}
.border-warning-900 {
border-color: var(--theme-warning-900);
}
.border-warning-800 {
border-color: var(--theme-warning-800);
}
.border-warning-700 {
border-color: var(--theme-warning-700);
}
.border-warning-600 {
border-color: var(--theme-warning-600);
}
.border-warning-500 {
border-color: var(--theme-warning-500);
}
.border-warning-400 {
border-color: var(--theme-warning-400);
}
.border-warning-300 {
border-color: var(--theme-warning-300);
}
.border-warning-200 {
border-color: var(--theme-warning-200);
}
.border-warning-100 {
border-color: var(--theme-warning-100);
}
.border-warning-50 {
border-color: var(--theme-warning-50);
}
.text-warning-900 {
color: var(--theme-warning-900);
}
.text-warning-800 {
color: var(--theme-warning-800);
}
.text-warning-700 {
color: var(--theme-warning-700);
}
.text-warning-600 {
color: var(--theme-warning-600);
}
.text-warning-500 {
color: var(--theme-warning-500);
}
.text-warning-400 {
color: var(--theme-warning-400);
}
.text-warning-300 {
color: var(--theme-warning-300);
}
.text-warning-200 {
color: var(--theme-warning-200);
}
.text-warning-100 {
color: var(--theme-warning-100);
}
.text-warning-50 {
color: var(--theme-warning-50);
}
.ring-theme-warning,
.focus\:ring-theme-warning:focus {
box-shadow: 0 0 0 4px var(--theme-warning-400-25);
}
.bg-danger-900 {
background-color: var(--theme-danger-900);
}
.bg-danger-800 {
background-color: var(--theme-danger-800);
}
.bg-danger-700 {
background-color: var(--theme-danger-700);
}
.bg-danger-600 {
background-color: var(--theme-danger-600);
}
.bg-danger-500 {
background-color: var(--theme-danger-500);
}
.bg-danger-400 {
background-color: var(--theme-danger-400);
}
.bg-danger-300 {
background-color: var(--theme-danger-300);
}
.bg-danger-200 {
background-color: var(--theme-danger-200);
}
.bg-danger-100 {
background-color: var(--theme-danger-100);
}
.bg-danger-50 {
background-color: var(--theme-danger-50);
}
.border-danger-900 {
border-color: var(--theme-danger-900);
}
.border-danger-800 {
border-color: var(--theme-danger-800);
}
.border-danger-700 {
border-color: var(--theme-danger-700);
}
.border-danger-600 {
border-color: var(--theme-danger-600);
}
.border-danger-500 {
border-color: var(--theme-danger-500);
}
.border-danger-400 {
border-color: var(--theme-danger-400);
}
.border-danger-300 {
border-color: var(--theme-danger-300);
}
.border-danger-200 {
border-color: var(--theme-danger-200);
}
.border-danger-100 {
border-color: var(--theme-danger-100);
}
.border-danger-50 {
border-color: var(--theme-danger-50);
}
.text-danger-900 {
color: var(--theme-danger-900);
}
.text-danger-800 {
color: var(--theme-danger-800);
}
.text-danger-700 {
color: var(--theme-danger-700);
}
.text-danger-600 {
color: var(--theme-danger-600);
}
.text-danger-500 {
color: var(--theme-danger-500);
}
.text-danger-400 {
color: var(--theme-danger-400);
}
.text-danger-300 {
color: var(--theme-danger-300);
}
.text-danger-200 {
color: var(--theme-danger-200);
}
.text-danger-100 {
color: var(--theme-danger-100);
}
.text-danger-50 {
color: var(--theme-danger-50);
}
.ring-theme-danger,
.focus\:ring-theme-danger:focus {
box-shadow: 0 0 0 4px var(--theme-danger-400-25);
}
.bg-gray-900 {
background-color: var(--theme-gray-900);
}
.bg-gray-800 {
background-color: var(--theme-gray-800);
}
.bg-gray-700 {
background-color: var(--theme-gray-700);
}
.bg-gray-600 {
background-color: var(--theme-gray-600);
}
.bg-gray-500 {
background-color: var(--theme-gray-500);
}
.bg-gray-400 {
background-color: var(--theme-gray-400);
}
.bg-gray-300 {
background-color: var(--theme-gray-300);
}
.bg-gray-200 {
background-color: var(--theme-gray-200);
}
.bg-gray-100 {
background-color: var(--theme-gray-100);
}
.bg-gray-50 {
background-color: var(--theme-gray-50);
}
.border-gray-900 {
border-color: var(--theme-gray-900);
}
.border-gray-800 {
border-color: var(--theme-gray-800);
}
.border-gray-700 {
border-color: var(--theme-gray-700);
}
.border-gray-600 {
border-color: var(--theme-gray-600);
}
.border-gray-500 {
border-color: var(--theme-gray-500);
}
.border-gray-400 {
border-color: var(--theme-gray-400);
}
.border-gray-300 {
border-color: var(--theme-gray-300);
}
.border-gray-200 {
border-color: var(--theme-gray-200);
}
.border-gray-100 {
border-color: var(--theme-gray-100);
}
.border-gray-50 {
border-color: var(--theme-gray-50);
}
.text-gray-900 {
color: var(--theme-gray-900);
}
.text-gray-800 {
color: var(--theme-gray-800);
}
.text-gray-700 {
color: var(--theme-gray-700);
}
.text-gray-600 {
color: var(--theme-gray-600);
}
.text-gray-500 {
color: var(--theme-gray-500);
}
.text-gray-400 {
color: var(--theme-gray-400);
}
.text-gray-300 {
color: var(--theme-gray-300);
}
.text-gray-200 {
color: var(--theme-gray-200);
}
.text-gray-100 {
color: var(--theme-gray-100);
}
.text-gray-50 {
color: var(--theme-gray-50);
}
.ring-theme-gray,
.focus\:ring-theme-gray:focus {
box-shadow: 0 0 0 4px var(--theme-gray-400-25);
}
.button {
--switch: calc((var(--theme-brand-l) - 70%) * -100);
color: hsl(0, 0%, var(--switch));
height: var(--theme-form-size);
display: block;
cursor: pointer;
background-color: var(--theme-brand-500);
border-radius: var(--theme-button-border-radius);
font-family: var(--theme-button-font-family);
padding: var(--theme-button-padding);
box-shadow: var(--theme-button-box-shadow);
}
.button:hover {
background-color: var(--theme-brand-600);
}
.button:active {
background-color: var(--theme-brand-700);
}
.button.is-selected {
background-color: var(--theme-brand-800);
}
.button:focus,
.button.button-plain:focus,
.button.button-lg:focus {
outline: none;
box-shadow: var(--theme-form-focus-ring);
}
.button:disabled {
opacity: 0.5;
}
.button.button-sm {
height: var(--theme-form-size--sm);
}
.button.button-plain {
background-color: transparent;
color: var(--theme-gray-800);
box-shadow: none;
}
.button.button-plain:hover {
background-color: var(--theme-gray-200);
}
.button.button-lg {
height: var(--theme-form-size--lg);
border-radius: var(--theme-button-border-radius--lg);
box-shadow: var(--theme-button-box-shadow--lg);
}
.button.button-danger {
color: hsl(0, 0%, calc((var(--theme-danger-l) - 70%) * -100));
background-color: var(--theme-danger-500);
}
.button.button-danger:hover {
background-color: var(--theme-danger-600);
}
.button.button-danger:active {
background-color: var(--theme-danger-700);
}
.button.button-danger.is-selected {
background-color: var(--theme-danger-800);
}
.button.button-danger:focus,
.button.button-danger.button-lg:focus {
outline: none;
box-shadow: 0 0 0 0.25rem var(--theme-danger-500-25);
}
.button.button-confirm {
color: hsl(0, 0%, calc((var(--theme-confirm-l) - 70%) * -100));
background-color: var(--theme-confirm-500);
}
.button.button-secondary {
border-color: var(--theme-brand-500);
border-width: 1px;
background-color: transparent;
color: var(--theme-brand-500);
}
.button.button-secondary:hover {
background-color: var(--theme-brand-100);
}
.button.button-secondary:active {
background-color: var(--theme-brand-200);
}
.button.button-secondary.is-selected {
background-color: var(--theme-brand-300);
color: var(--theme-brand-900);
}
.button.button-confirm:hover {
background-color: var(--theme-confirm-600);
}
.button.button-confirm:active {
background-color: var(--theme-confirm-700);
}
.button.button-confirm.is-selected {
background-color: var(--theme-confirm-800);
}
.button.button-confirm:focus,
.button.button-confirm.button-lg:focus {
outline: none;
box-shadow: 0 0 0 0.25rem var(--theme-confirm-500-25);
}
.button.button-gray {
color: #fff;
background-color: var(--theme-gray-500);
}
.button.button-gray:hover {
background-color: var(--theme-gray-600);
}
.button.button-gray:active {
background-color: var(--theme-gray-700);
}
.button.button-gray.is-selected {
background-color: var(--theme-gray-800);
}
.button.button-gray:focus,
.button.button-gray.button-lg:focus {
outline: none;
box-shadow: 0 0 0 0.25rem var(--theme-gray-500-25);
}
.input {
height: var(--theme-form-size);
width: 100%;
font-family: var(--theme-input-font-family);
padding: var(--theme-input-padding);
box-shadow: var(--theme-input-box-shadow);
background-color: var(--theme-input-background-color);
border-width: var(--theme-input-border-width);
border-color: var(--theme-input-border-color);
border-radius: var(--theme-input-border-radius);
color: var(--theme-input-color);
}
.input::placeholder {
color: var(--theme-input-placeholder-color);
}
.input:focus {
outline: none;
border-color: var(--theme-brand-400);
box-shadow: var(--theme-form-focus-ring);
}
.input:disabled {
opacity: 0.5;
}
.input.input-sm {
height: var(--theme-form-size--sm);
}
.label {
font-weight: 500;
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.06rem;
margin-left: 0.6rem;
margin-bottom: 0.25rem;
}
.checkbox {
height: var(--theme-form-size);
width: var(--theme-form-size);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
display: block;
flex-shrink: 0;
border-width: var(--theme-input-border-width);
border-color: var(--theme-input-border-color);
border-radius: var(--theme-input-border-radius);
background-color: var(--theme-input-background-color);
box-shadow: var(--theme-checkbox-box-shadow);
}
.checkbox:focus {
outline: none;
border-color: var(--theme-brand-400);
box-shadow: var(--theme-form-focus-ring);
}
.checkbox:checked {
background-color: #1d7cae;
border-color: #1d7cae;
background-position: center center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19.813 6.187c.45.449.45 1.177 0 1.626l-10 10a1.15 1.15 0 0 1-1.626 0l-4-4a1.15 1.15 0 0 1 1.626-1.626L9 15.374l9.187-9.187a1.15 1.15 0 0 1 1.626 0Z' fill='%23fff'/%3E%3C/svg%3E");
}
.checkbox:disabled {
opacity: 0.5;
}
.checkbox.checkbox-sm {
width: var(--theme-form-size--sm);
height: var(--theme-form-size--sm);
}
.select {
height: var(--theme-form-size);
width: 100%;
font-family: var(--theme-input-font-family);
padding: var(--theme-input-padding);
box-shadow: var(--theme-input-box-shadow);
background-color: var(--theme-input-background-color);
border-width: var(--theme-input-border-width);
border-color: var(--theme-input-border-color);
border-radius: var(--theme-input-border-radius);
color: var(--theme-input-color);
display: inline-block;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
background-position: right 0.6rem center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg width='16' height='9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 1 8 8 1 1' stroke='%2335444F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.select:focus {
outline: none;
border-color: var(--theme-brand-400);
box-shadow: var(--theme-form-focus-ring);
}
.textarea {
width: 100%;
font-family: var(--theme-input-font-family);
padding: var(--theme-textarea-padding);
box-shadow: var(--theme-input-box-shadow);
background-color: var(--theme-input-background-color);
border-width: var(--theme-input-border-width);
border-color: var(--theme-input-border-color);
border-radius: var(--theme-input-border-radius);
color: var(--theme-input-color);
}
.textarea::placeholder {
color: var(--theme-input-placeholder-color);
}
.textarea:focus {
outline: none;
border-color: var(--theme-brand-400);
box-shadow: var(--theme-form-focus-ring);
}
.textarea:disabled {
opacity: 0.5;
}
const root = document.documentElement;
const range100 = document.querySelector('.range-100');
const range200 = document.querySelector('.range-200');
const range300 = document.querySelector('.range-300');
const range400 = document.querySelector('.range-400');
const range600 = document.querySelector('.range-600');
const range700 = document.querySelector('.range-700');
const range800 = document.querySelector('.range-800');
const range900 = document.querySelector('.range-900');
range100.addEventListener('input', e => root.style.setProperty('--step-100-value', e.target.value));
range200.addEventListener('input', e => root.style.setProperty('--step-200-value', e.target.value));
range300.addEventListener('input', e => root.style.setProperty('--step-300-value', e.target.value));
range400.addEventListener('input', e => root.style.setProperty('--step-400-value', e.target.value));
range600.addEventListener('input', e => root.style.setProperty('--step-600-value', e.target.value));
range700.addEventListener('input', e => root.style.setProperty('--step-700-value', e.target.value));
range800.addEventListener('input', e => root.style.setProperty('--step-800-value', e.target.value));
range900.addEventListener('input', e => root.style.setProperty('--step-900-value', e.target.value));
function getColor() {
let input = document.querySelector('#usr-clr')
let color = HexToHSL(input.value)
root.style.setProperty('--theme-brand-h', color.h);
root.style.setProperty('--theme-brand-s', color.s + '%');
root.style.setProperty('--theme-brand-l', color.l + '%');
// console.log('hsl(' + color.h + ', ' + color.s + '%, ' + color.l + '%)')
}
function HexToHSL(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
var r = parseInt(result[1], 16);
var g = parseInt(result[2], 16);
var b = parseInt(result[3], 16);
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min){
h = s = 0; // achromatic
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
s = s*100;
s = Math.round(s);
l = l*100;
l = Math.round(l);
h = Math.round(360*h);
return {h, s, l};
}
Also see: Tab Triggers