Skip to content

Commit 9575177

Browse files
authored
feat: ✨ enhance cloning so two-color icons adhere to same-palette rule (#2932)
1 parent 0b19026 commit 9575177

File tree

1 file changed

+10
-0
lines changed
  • src/core/generator/clones/utils/color

1 file changed

+10
-0
lines changed

src/core/generator/clones/utils/color/colors.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ export const replacementMap = (baseColor: string, colors: Set<string>) => {
109109
const color = chroma(orderedColors[i]);
110110
let newColor = color.set('hsl.h', baseHue);
111111

112+
// if it's a simple, 2-color icon, we also retain the saturation
113+
// from the base color. This helps us better adhere to the
114+
// same-palette rule in the extension's guidelines; keeping both
115+
// colors within the same "color column" of the material palette.
116+
// This mainly affects folder icons, which usually have 2-color
117+
// designs.
118+
if (orderedColors.length === 2) {
119+
newColor = newColor.set('hsl.s', baseColorChroma.get('hsl.s'));
120+
}
121+
112122
// the idea is to keep the paths with the same relative darkness
113123
// as the original icon, but with different hues. So if the
114124
// new color results in a darker color (as we are looping from

0 commit comments

Comments
 (0)