@udixio/theme 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +50 -49
- package/index.esm.js +50 -49
- package/package.json +1 -1
- package/src/lib/theme/variant.d.ts +0 -6
- package/src/lib/theme/variants/index.d.ts +6 -0
package/index.cjs.js
CHANGED
|
@@ -1646,12 +1646,6 @@ const getRotatedHue = (sourceColorHct, hueBreakpoints, rotations) => {
|
|
|
1646
1646
|
}
|
|
1647
1647
|
return materialColorUtilities.sanitizeDegreesDouble(sourceColorHct.hue + rotation);
|
|
1648
1648
|
};
|
|
1649
|
-
const Variants = {
|
|
1650
|
-
Expressive: expressiveVariant,
|
|
1651
|
-
Neutral: neutralVariant,
|
|
1652
|
-
TonalSpot: tonalSpotVariant,
|
|
1653
|
-
Vibrant: vibrantVariant,
|
|
1654
|
-
};
|
|
1655
1649
|
class Variant {
|
|
1656
1650
|
constructor(palettes = {}, name, customPalettes,
|
|
1657
1651
|
/** TODO
|
|
@@ -1666,49 +1660,6 @@ class Variant {
|
|
|
1666
1660
|
}
|
|
1667
1661
|
}
|
|
1668
1662
|
|
|
1669
|
-
const tonalSpotVariant = {
|
|
1670
|
-
name: 'tonalSpot',
|
|
1671
|
-
palettes: {
|
|
1672
|
-
primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 26 : 32),
|
|
1673
|
-
secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16),
|
|
1674
|
-
tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), 28),
|
|
1675
|
-
neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
|
|
1676
|
-
neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
|
|
1677
|
-
error: ({ sourceColorHct }) => {
|
|
1678
|
-
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1679
|
-
return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 60);
|
|
1680
|
-
},
|
|
1681
|
-
},
|
|
1682
|
-
customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, 16),
|
|
1683
|
-
};
|
|
1684
|
-
|
|
1685
|
-
const getVibrantNeutralHue = (sourceColorHct) => {
|
|
1686
|
-
return getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
|
|
1687
|
-
};
|
|
1688
|
-
const getVibrantNeutralChroma = (sourceColorHct) => {
|
|
1689
|
-
getVibrantNeutralHue(sourceColorHct);
|
|
1690
|
-
return 28;
|
|
1691
|
-
};
|
|
1692
|
-
const vibrantVariant = {
|
|
1693
|
-
name: 'vibrant',
|
|
1694
|
-
palettes: {
|
|
1695
|
-
primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
|
|
1696
|
-
secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1697
|
-
tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56),
|
|
1698
|
-
neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getVibrantNeutralHue(sourceColorHct), getVibrantNeutralChroma(sourceColorHct)),
|
|
1699
|
-
neutralVariant: ({ sourceColorHct }) => {
|
|
1700
|
-
const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
|
|
1701
|
-
const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
|
|
1702
|
-
return materialColorUtilities.TonalPalette.fromHueAndChroma(vibrantNeutralHue, vibrantNeutralChroma * 1.29);
|
|
1703
|
-
},
|
|
1704
|
-
error: ({ sourceColorHct }) => {
|
|
1705
|
-
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1706
|
-
return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 80);
|
|
1707
|
-
},
|
|
1708
|
-
},
|
|
1709
|
-
customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(colorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
1663
|
const getExpressiveNeutralHue = (sourceColorHct) => {
|
|
1713
1664
|
const hue = getRotatedHue(sourceColorHct, [0, 71, 124, 253, 278, 300, 360], [10, 0, 10, 0, 10, 0]);
|
|
1714
1665
|
return hue;
|
|
@@ -1756,6 +1707,56 @@ const neutralVariant = {
|
|
|
1756
1707
|
customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, Hct.isBlue(colorHct.hue) ? 6 : 4),
|
|
1757
1708
|
};
|
|
1758
1709
|
|
|
1710
|
+
const tonalSpotVariant = {
|
|
1711
|
+
name: 'tonalSpot',
|
|
1712
|
+
palettes: {
|
|
1713
|
+
primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 26 : 32),
|
|
1714
|
+
secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16),
|
|
1715
|
+
tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), 28),
|
|
1716
|
+
neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
|
|
1717
|
+
neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
|
|
1718
|
+
error: ({ sourceColorHct }) => {
|
|
1719
|
+
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1720
|
+
return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 60);
|
|
1721
|
+
},
|
|
1722
|
+
},
|
|
1723
|
+
customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, 16),
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
const getVibrantNeutralHue = (sourceColorHct) => {
|
|
1727
|
+
return getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
|
|
1728
|
+
};
|
|
1729
|
+
const getVibrantNeutralChroma = (sourceColorHct) => {
|
|
1730
|
+
getVibrantNeutralHue(sourceColorHct);
|
|
1731
|
+
return 28;
|
|
1732
|
+
};
|
|
1733
|
+
const vibrantVariant = {
|
|
1734
|
+
name: 'vibrant',
|
|
1735
|
+
palettes: {
|
|
1736
|
+
primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
|
|
1737
|
+
secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1738
|
+
tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56),
|
|
1739
|
+
neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getVibrantNeutralHue(sourceColorHct), getVibrantNeutralChroma(sourceColorHct)),
|
|
1740
|
+
neutralVariant: ({ sourceColorHct }) => {
|
|
1741
|
+
const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
|
|
1742
|
+
const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
|
|
1743
|
+
return materialColorUtilities.TonalPalette.fromHueAndChroma(vibrantNeutralHue, vibrantNeutralChroma * 1.29);
|
|
1744
|
+
},
|
|
1745
|
+
error: ({ sourceColorHct }) => {
|
|
1746
|
+
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1747
|
+
return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 80);
|
|
1748
|
+
},
|
|
1749
|
+
},
|
|
1750
|
+
customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(getRotatedHue(colorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
const Variants = {
|
|
1754
|
+
Expressive: expressiveVariant,
|
|
1755
|
+
Neutral: neutralVariant,
|
|
1756
|
+
TonalSpot: tonalSpotVariant,
|
|
1757
|
+
Vibrant: vibrantVariant,
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1759
1760
|
const defaultColors = (colorService) => {
|
|
1760
1761
|
const getColor = (key) => {
|
|
1761
1762
|
return colorService.getColor(key).getMaterialColor();
|
package/index.esm.js
CHANGED
|
@@ -1644,12 +1644,6 @@ const getRotatedHue = (sourceColorHct, hueBreakpoints, rotations) => {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
return sanitizeDegreesDouble(sourceColorHct.hue + rotation);
|
|
1646
1646
|
};
|
|
1647
|
-
const Variants = {
|
|
1648
|
-
Expressive: expressiveVariant,
|
|
1649
|
-
Neutral: neutralVariant,
|
|
1650
|
-
TonalSpot: tonalSpotVariant,
|
|
1651
|
-
Vibrant: vibrantVariant,
|
|
1652
|
-
};
|
|
1653
1647
|
class Variant {
|
|
1654
1648
|
constructor(palettes = {}, name, customPalettes,
|
|
1655
1649
|
/** TODO
|
|
@@ -1664,49 +1658,6 @@ class Variant {
|
|
|
1664
1658
|
}
|
|
1665
1659
|
}
|
|
1666
1660
|
|
|
1667
|
-
const tonalSpotVariant = {
|
|
1668
|
-
name: 'tonalSpot',
|
|
1669
|
-
palettes: {
|
|
1670
|
-
primary: ({ sourceColorHct, isDark }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 26 : 32),
|
|
1671
|
-
secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16),
|
|
1672
|
-
tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), 28),
|
|
1673
|
-
neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
|
|
1674
|
-
neutralVariant: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
|
|
1675
|
-
error: ({ sourceColorHct }) => {
|
|
1676
|
-
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1677
|
-
return TonalPalette.fromHueAndChroma(errorHue, 60);
|
|
1678
|
-
},
|
|
1679
|
-
},
|
|
1680
|
-
customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(colorHct.hue, 16),
|
|
1681
|
-
};
|
|
1682
|
-
|
|
1683
|
-
const getVibrantNeutralHue = (sourceColorHct) => {
|
|
1684
|
-
return getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
|
|
1685
|
-
};
|
|
1686
|
-
const getVibrantNeutralChroma = (sourceColorHct) => {
|
|
1687
|
-
getVibrantNeutralHue(sourceColorHct);
|
|
1688
|
-
return 28;
|
|
1689
|
-
};
|
|
1690
|
-
const vibrantVariant = {
|
|
1691
|
-
name: 'vibrant',
|
|
1692
|
-
palettes: {
|
|
1693
|
-
primary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
|
|
1694
|
-
secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1695
|
-
tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56),
|
|
1696
|
-
neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getVibrantNeutralHue(sourceColorHct), getVibrantNeutralChroma(sourceColorHct)),
|
|
1697
|
-
neutralVariant: ({ sourceColorHct }) => {
|
|
1698
|
-
const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
|
|
1699
|
-
const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
|
|
1700
|
-
return TonalPalette.fromHueAndChroma(vibrantNeutralHue, vibrantNeutralChroma * 1.29);
|
|
1701
|
-
},
|
|
1702
|
-
error: ({ sourceColorHct }) => {
|
|
1703
|
-
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1704
|
-
return TonalPalette.fromHueAndChroma(errorHue, 80);
|
|
1705
|
-
},
|
|
1706
|
-
},
|
|
1707
|
-
customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(colorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1708
|
-
};
|
|
1709
|
-
|
|
1710
1661
|
const getExpressiveNeutralHue = (sourceColorHct) => {
|
|
1711
1662
|
const hue = getRotatedHue(sourceColorHct, [0, 71, 124, 253, 278, 300, 360], [10, 0, 10, 0, 10, 0]);
|
|
1712
1663
|
return hue;
|
|
@@ -1754,6 +1705,56 @@ const neutralVariant = {
|
|
|
1754
1705
|
customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(colorHct.hue, Hct.isBlue(colorHct.hue) ? 6 : 4),
|
|
1755
1706
|
};
|
|
1756
1707
|
|
|
1708
|
+
const tonalSpotVariant = {
|
|
1709
|
+
name: 'tonalSpot',
|
|
1710
|
+
palettes: {
|
|
1711
|
+
primary: ({ sourceColorHct, isDark }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 26 : 32),
|
|
1712
|
+
secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16),
|
|
1713
|
+
tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), 28),
|
|
1714
|
+
neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
|
|
1715
|
+
neutralVariant: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
|
|
1716
|
+
error: ({ sourceColorHct }) => {
|
|
1717
|
+
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1718
|
+
return TonalPalette.fromHueAndChroma(errorHue, 60);
|
|
1719
|
+
},
|
|
1720
|
+
},
|
|
1721
|
+
customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(colorHct.hue, 16),
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
const getVibrantNeutralHue = (sourceColorHct) => {
|
|
1725
|
+
return getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
|
|
1726
|
+
};
|
|
1727
|
+
const getVibrantNeutralChroma = (sourceColorHct) => {
|
|
1728
|
+
getVibrantNeutralHue(sourceColorHct);
|
|
1729
|
+
return 28;
|
|
1730
|
+
};
|
|
1731
|
+
const vibrantVariant = {
|
|
1732
|
+
name: 'vibrant',
|
|
1733
|
+
palettes: {
|
|
1734
|
+
primary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
|
|
1735
|
+
secondary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1736
|
+
tertiary: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56),
|
|
1737
|
+
neutral: ({ sourceColorHct }) => TonalPalette.fromHueAndChroma(getVibrantNeutralHue(sourceColorHct), getVibrantNeutralChroma(sourceColorHct)),
|
|
1738
|
+
neutralVariant: ({ sourceColorHct }) => {
|
|
1739
|
+
const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
|
|
1740
|
+
const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
|
|
1741
|
+
return TonalPalette.fromHueAndChroma(vibrantNeutralHue, vibrantNeutralChroma * 1.29);
|
|
1742
|
+
},
|
|
1743
|
+
error: ({ sourceColorHct }) => {
|
|
1744
|
+
const errorHue = getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
1745
|
+
return TonalPalette.fromHueAndChroma(errorHue, 80);
|
|
1746
|
+
},
|
|
1747
|
+
},
|
|
1748
|
+
customPalettes: ({ colorHct }) => TonalPalette.fromHueAndChroma(getRotatedHue(colorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), 56),
|
|
1749
|
+
};
|
|
1750
|
+
|
|
1751
|
+
const Variants = {
|
|
1752
|
+
Expressive: expressiveVariant,
|
|
1753
|
+
Neutral: neutralVariant,
|
|
1754
|
+
TonalSpot: tonalSpotVariant,
|
|
1755
|
+
Vibrant: vibrantVariant,
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1757
1758
|
const defaultColors = (colorService) => {
|
|
1758
1759
|
const getColor = (key) => {
|
|
1759
1760
|
return colorService.getColor(key).getMaterialColor();
|
package/package.json
CHANGED
|
@@ -3,12 +3,6 @@ import { Hct } from '../material-color-utilities/htc';
|
|
|
3
3
|
import { AddColors } from '../color';
|
|
4
4
|
export declare const getPiecewiseHue: (sourceColorHct: Hct, hueBreakpoints: number[], hues: number[]) => number;
|
|
5
5
|
export declare const getRotatedHue: (sourceColorHct: Hct, hueBreakpoints: number[], rotations: number[]) => number;
|
|
6
|
-
export declare const Variants: {
|
|
7
|
-
Expressive: Variant;
|
|
8
|
-
Neutral: Variant;
|
|
9
|
-
TonalSpot: Variant;
|
|
10
|
-
Vibrant: Variant;
|
|
11
|
-
};
|
|
12
6
|
export declare class Variant {
|
|
13
7
|
palettes: Record<string, (args: {
|
|
14
8
|
sourceColorHct: Hct;
|
|
@@ -2,3 +2,9 @@ export * from './tonal-spot.variant';
|
|
|
2
2
|
export * from './vibrant.variant';
|
|
3
3
|
export * from './expressive.variant';
|
|
4
4
|
export * from './neutral.variant';
|
|
5
|
+
export declare const Variants: {
|
|
6
|
+
Expressive: import("..").Variant;
|
|
7
|
+
Neutral: import("..").Variant;
|
|
8
|
+
TonalSpot: import("..").Variant;
|
|
9
|
+
Vibrant: import("..").Variant;
|
|
10
|
+
};
|