Skip to content

Commit 1423aa7

Browse files
authoredFeb 20, 2024··
refactor(Tokens)!: simplify the declarative design tokens (#835)
BREAKING CHANGE: all the tokens related to hover, active, and disable states have been removed. Before, we used to have e.g. primary-hover, and primary-active applied on a button when it hovered or active, this refactor relies now on the use of color-mix() to archive the same result.
1 parent c7e6ae0 commit 1423aa7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+575
-955
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
type blendOptions = {
2+
color: string;
3+
base: string;
4+
percentage?: number;
5+
property?: string;
6+
};
7+
/**
8+
* Blend color with base color and percentage
9+
*
10+
* @param {Object} opt - The blendColor options object
11+
* @param {string} opt.color - The color to blend
12+
* @param {string} opt.base - The base color layer to blend with
13+
* @param {number} opt.percentage - The percentage to blend
14+
* @param {string} [opt.property ='background-color'] - The CSS property to blend (e.g: 'background-color', 'color')
15+
*/
16+
export const blendColor = ({ color, base, percentage = 20, property = 'background-color' }: blendOptions) => ({
17+
[property]: `color-mix(in srgb, ${color}, ${base} ${percentage}%)`,
18+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './blend-color';

0 commit comments

Comments
 (0)
Please sign in to comment.