-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update color-picker extension #17593
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution! 🎉 🔔 @thomaspaulmann @otakustay @EmersonEmerson @pernielsentikaer @arronhunt @kvdo2 @thomaslombart @LitoMore @samuelkraft @xilopaint @anwarulislam you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. Due to our current reduced availability, the initial review may take up to 10-15 business days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds a color format dropdown option to the Convert Color command in the color-picker extension, allowing users to directly select their desired output format.
getSelectedText()
in/extensions/color-picker/src/convert-color.tsx
should be wrapped in try-catch for graceful error handling- Could simplify error handling in
getConvertedColor()
by usingshowFailureToast
from@raycast/utils
instead of manualshowToast
- The [Extract Color] changelog entry from 2025-02-25 is missing the required
{PR_MERGE_DATE}
template string - The new format dropdown argument in
package.json
provides a comprehensive set of color format options matching the existing preferences
5 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
extensions/color-picker/package.json
Outdated
"name": "format", | ||
"type": "dropdown", | ||
"placeholder": "Convert Format", | ||
"required": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider making the format argument optional and defaulting to the user's preferred format from preferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like this idea: having a default in preferences so you don't have to set it every time. What do you think, @LitoMore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea because we can make the default value for the last selected option. But the problem is the option title is hardcoded in the package.json
. We don't have a proper way to show the name of the last selection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like this idea: having a default in preferences so you don't have to set it every time.
I like this idea too, but the argument dropdown will store the most recently used value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it does, just tested in my Figlet command and it's resetting, that why I did this

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, looking briefly through some code, it seems like it actually saves the last value. I was able to restart Raycast, and the value is persisted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked again. It only persisted for a short amount of time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked again after a long time, but the last value still exists. 🤔
If it really only persisted for a short time, I think I can change the required
attribute to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not intended to be preserved over time 🫠
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, why don't we change this command to view
mode? We can list all supported converted values in a list. And we can always move the last used selection to the top for users.
In the meantime, we can change the input value to accept any string and use the color-string (I'm the maintainer of the color-string
project as well) to detect user's input.
if (props.arguments.text) { | ||
const convertedColor = await getConvertedColor(props.arguments.text); | ||
const convertedColor = await getConvertedColor(props.arguments.text, props.arguments.format); | ||
if (convertedColor) { | ||
await Clipboard.copy(convertedColor); | ||
await showHUD("Copied color to clipboard"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: launchCommand should be wrapped in try/catch according to Raycast guidelines
if (props.arguments.text) { | |
const convertedColor = await getConvertedColor(props.arguments.text); | |
const convertedColor = await getConvertedColor(props.arguments.text, props.arguments.format); | |
if (convertedColor) { | |
await Clipboard.copy(convertedColor); | |
await showHUD("Copied color to clipboard"); | |
} | |
try { | |
if (props.arguments.text) { | |
const convertedColor = await getConvertedColor(props.arguments.text, props.arguments.format); | |
if (convertedColor) { | |
await Clipboard.copy(convertedColor); | |
await showHUD("Copied color to clipboard"); | |
} | |
} |
Description
Add the color format dropdown option to the
Convert Color
command, to let user can direct select the format they want to convert.Close #17553
Screencast
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are located outside the metadata folder if they were not generated with our metadata tool