Skip to content

Commit

Permalink
Update hue-palette extension (#16757)
Browse files Browse the repository at this point in the history
* Update hue-palette extension

* Update CHANGELOG.md and optimise images

---------

Co-authored-by: raycastbot <[email protected]>
  • Loading branch information
ridemountainpig and raycastbot authored Feb 2, 2025
1 parent 92673f4 commit 3ecb95c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions extensions/hue-palette/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Hue Changelog

## [Feature] - 2025-02-02

- Added the action to copy the new Tailwind CSS version 4.0 configuration code.

## [Feature] - 2025-01-19

- Added the `Search Hue Palette History` feature to track the history of generated Hue palette.
Expand Down
22 changes: 19 additions & 3 deletions extensions/hue-palette/src/components/hue-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ export default function HueDetail({
tailwind_colors_name,
tailwind_colors,
}: HueDetailProps) {
function convertToV4(colors = {}) {
let cssVariables = "@theme {\n";
for (const [colorLevel, hex] of Object.entries(colors)) {
cssVariables += ` --color-${tailwind_colors_name}-${colorLevel}: ${hex};\n`;
}
cssVariables += "}";
return cssVariables;
}
const tailwindColorsV3 = tailwind_colors;
const tailwindColorsV4 = convertToV4(tailwindColorsV3);

return (
<Grid columns={5} filtering={false} isLoading={isLoading}>
<Grid.Section title={name}>
Expand All @@ -31,15 +42,20 @@ export default function HueDetail({
actions={
<ActionPanel>
<Action.CopyToClipboard
title="Copy Hue Color to Clipboard"
title="Copy Hue Color"
content={color}
/>
<Action.CopyToClipboard
title="Copy Tailwind Hue to Clipboard"
title="Copy Hue Tailwind V4 Config Code"
content={tailwindColorsV4}
/>
<Action.CopyToClipboard
title="Copy Hue Tailwind V3 Config Code"
content={
`${tailwind_colors_name}:` +
JSON.stringify(tailwind_colors, null, 4)
JSON.stringify(tailwindColorsV3, null, 2)
}
shortcut={{ modifiers: ["cmd"], key: "t" }}
/>
{isGenerator ? (
<Action.OpenInBrowser
Expand Down

0 comments on commit 3ecb95c

Please sign in to comment.