Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hex Color Item Format (#FFFFFF) #1583

Closed
kalitara opened this issue Feb 14, 2021 · 4 comments
Closed

Hex Color Item Format (#FFFFFF) #1583

kalitara opened this issue Feb 14, 2021 · 4 comments
Labels
feature New feature request

Comments

@kalitara
Copy link

Is your feature request related to a problem? Please describe.
There is no problem.

Describe the solution you'd like
I'm copying colors all the time as I work on graphic design projects. The colors are written in hex format (#FFFFFF) and can be in upper case, lower case, or combination. The expression matching is very simple.

I would like CopyQ to identify copied colors and, if the item format is enabled, shade the background of the entry with the color described in the copied text.

The item display would revert to the current behavior of appearance when selected or hovered over.

This would just be a new item format, maybe called RGB (or something more descriptive), in the format list of the Items tab in preferences.

Possible Options:

  • Hide/Show item text
    (the background color identifies the RGB item).
    (The text would revert to visible when item is selected or hovered).

Enhancement: It would be nice if the foreground color of the entry had logic so that the text is visible over the background color it describes.

Option for enhancement:

  • Turn foreground text color enhanced logic on/off

Describe alternatives you've considered
It's definitely a new feature.

Additional context

@kalitara kalitara added the feature New feature request label Feb 14, 2021
@hluk
Copy link
Owner

hluk commented Feb 15, 2021

The best way to show colors that I can think of is using a Display command below:

image

[Command]
Command="
    copyq:
    var color = str(input())
    setData(mimeHtml,
        '<table><tr>'
        + '<td width=\"14\" bgcolor=\"' + color + '\"></td>'
        + '<td> ' + color + '</td>'
        + '</tr></table>'
    )"
Display=true
Icon=\xf53f
Input=text/plain
Match=^#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]
Name=Show Colors

(Here is how to add the command to CopyQ.)

Another way would be to change the background of the item when a color is copied, but this would require fixing the text color:

[Command]
Automatic=true
Command="
    copyq:
    var color = str(input())
    setData(mimeColor, color)"
Icon=\xf53f
Input=text/plain
Match=^#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]
Name=Show Colors

@kalitara
Copy link
Author

kalitara commented Mar 6, 2021

I like that look. I think I've seen that pattern used elsewhere too. I'll give it a try.

I had no idea about the command system. Time for me to read the manual.

@hluk hluk closed this as completed Mar 7, 2021
@bonnebulle
Copy link

bonnebulle commented Nov 16, 2023

I prefer a Regex matching #ff3737
not #mycssid... so, for me, this is better :
#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]$

Automatic + background

[Command]
Automatic=true
Command="
    copyq:
    var color = str(input())
    setData(mimeColor, color)"
Icon=\xf53f
Input=text/plain
Match=#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]$
Name=Show Colors auto startwith

@orschiro
Copy link
Contributor

The best way to show colors that I can think of is using a Display command below:

image

[Command]
Command="
    copyq:
    var color = str(input())
    setData(mimeHtml,
        '<table><tr>'
        + '<td width=\"14\" bgcolor=\"' + color + '\"></td>'
        + '<td> ' + color + '</td>'
        + '</tr></table>'
    )"
Display=true
Icon=\xf53f
Input=text/plain
Match=^#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]
Name=Show Colors

(Here is how to add the command to CopyQ.)

Another way would be to change the background of the item when a color is copied, but this would require fixing the text color:

[Command]
Automatic=true
Command="
    copyq:
    var color = str(input())
    setData(mimeColor, color)"
Icon=\xf53f
Input=text/plain
Match=^#[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]
Name=Show Colors

Thanks for this!

It correctly shows in the main menu but not in the tray icon.

Any idea why?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

4 participants