MACRO: Easily apply colors to KM Actions

I use the Keyboard Maestro Editor's ability to apply colors to actions quite liberally. I have certain colors set on favorite actions, but I also use colors while working on new macros—I'll put each routine into a large group, and color it red if it's non-functional, orange if it's working but needs changes, and green when it's done.

Applying colors in the editor, though, requires either a right-click to access the Set Color contextual menu, or using the Actions > Set Color menu item. Neither are conducive to quick and easy color setting. So I've got a small macro I've been using for years to make this easier, but a recent discussion here inspired me to clean it up and share it, in case others would also like faster access to colors while editing.

How it works

Invoke the macro with the hot key (it's set to Control-C as distributed), and a pop-up palette appears onscreen:

image

When the palette is onscreen, select one or more actions, then press the first letter of the color you want to apply—N for none, R for red, etc. You can leave the palette onscreen as long as you wish, but note that you cannot type the letters used in the palette while the palette is onscreen.

To dismiss the palette, press the Control key. If you try to apply a color without an action selected, the computer will speak an alert–I was using notifications, but they're basically not noticeable enough. Feel free to change that (in the "Set color subroutine" macro) if you wish.

If I want to just label something in a hurry, it's much quicker with the macro: Click on an action, press Control-C, type R or O or whatever, then press Control. No mouse movement required. And if I want to color a number of actions, I just leave the palette onscreen and press Control when done selecting and coloring.

———————————————

Macro details

__ ColorSetter Palette and Other Macros.kmmacros (412 KB)

The macro consists of two macro groups, both of which only work when the KM Editor is frontmost:

  • __ ColorSetter: This macro group contains the macro that enables and disables the palette, as well as the subroutine macro that sets the chosen color (and speaks up if nothing is selected).

  • __ ColorSetter Palette: This macro group builds the color selection palette. Each color gets a preview icon, taken directly from Keyboard Maestro's color selector, so you can get a preview before applying a color. The colors are listed, along with a couple blank lines for readability, and a reminder that the Control key dismisses the palette.

    Each macro in the palette is very simple: They call the color setting subroutine with the selected color as the parameter.

After downloading and installing the macro, enable the two macro groups, and change the hot key on the "Open color label palette" macro if you wish. And that's all there is to it.

———————————————

The rough version of this macro worked well, but I like the cleaned-up version even better (mainly I added in the preview icons and trapped on the color setting call so the macro handles things if nothing is selected). It's quite a basic macro, but it saves me a lot of mousing around.

-rob.

10 Likes

Thanks for sharing this macro, @griffman.

Although very cool and certainly not to criticize, I'm just curious: why do you use this technique vs simple assignment of hotkeys to each color?

For example, I'm constantly using action colors, so, for example I use ⌥y to set to yellow.

1 Like

I find it much simpler to have one hot key to remember, and then just a single key to type. I do this with a lot of my macros now, to cut down on hot key overload. That way, I can have single-modifier hot keys (which are simpler to type), followed by single-key macro activation keys.

For colors in particular, I often go through a macro once it's done and apply colors where I've missed them, so I like having the palette onscreen, so I can single-key color each thing that needs it.

-rob.

2 Likes

I get that, and I certainly have done the same for many items, e.g., inserting special symbols like ⌃⌥⇧⌘. But for me, I still use a few dedicated hotkeys for my most commonly used tasks.

Nice!

Very nice! I've been using this version below, though I think I prefer your macro for assigning different colors to multiple actions all at once, because the palette stays on screen.

2 Likes