Custom Background Color Shortcut

Everything related to our flagship word processor.
Post Reply
MSNELL
Posts: 6
Joined: 2020-06-17 04:06:05

Custom Background Color Shortcut

Post by MSNELL »

I'd like to create some custom background colors, and then have keyboard shortcuts for them. Is this possible?

martin
Official Nisus Person
Posts: 4736
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Custom Background Color Shortcut

Post by martin »

What you want is possible, but you'll have to set the colors indirectly. There's no built-in feature for adding custom colors to the menu directly. Here are a few options:

1. Apple's standard color panel (as used in Nisus Writer) lets you add custom colors. Once you've summoned the color panel in background color mode, you can click your favorite to apply it. That won't allow you to use a keyboard shortcut, but I thought I'd mention it.

2. Instead of applying a custom color to your text, why not apply a character style to your text? Your style can enforce the desired custom color. Styles can be assigned custom keyboard shortcuts, and have so many other benefits, eg: easily updatable, import between documents, etc.

3. If you don't want to work through styles, then a custom macro might be a good solution. You can create a macro for each particular color, and then assign the macro a custom keyboard shortcut. Such macros are simple to write. Here's an example:

Code: Select all

$color = Color.newWithHexTriplet("00CCFF")
Set Background Color $color
I hope that helps. Please let us know if you have any questions.

MSNELL
Posts: 6
Joined: 2020-06-17 04:06:05

Re: Custom Background Color Shortcut

Post by MSNELL »

It's good to know I can create a Character Style that way, but in this instance it will create a problem since I'm trying to add background color to text that is already in several different Character Styles (and needs to stay that way).

I've read through the introduction to macros in PDF manual, but unsure how complicated it would be to learn the "language"

I created a macro with your code (blue color) successfully. But don't know how to customize that in creating a new macro. And would the keyboard shortcut for macro be written into the macro code itself, or that's in keyboard preferences, like other formatting options?

Thanks, Matt

PS: should I move over to Macros forum?

User avatar
phspaelti
Posts: 1093
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Custom Background Color Shortcut

Post by phspaelti »

Hello Matt,
You would need to copy the above two line macro for each background color you wanted. You can customize it by changing the hextriplet. You can find the hextriplet for any color you want using the color panel. Just switch to the RGB sliders.
Screen Shot 2020-06-30 at 1.24.35 .png
Screen Shot 2020-06-30 at 1.24.35 .png (56.02 KiB) Viewed 63 times
Below the sliders you can see the Hex Color # for the selected color.
The Nisus macro language allows you to specify the color using the RGB system as well, either as fractions (0.0 – 1.0) or as 0-255 values, but the hextriplet method is the shortest.

To set a shortcut for your color, you will first need to save the macro giving it a name, and then set the shortcut using "Menu Keys" preferences.
philip

MSNELL
Posts: 6
Joined: 2020-06-17 04:06:05

Re: Custom Background Color Shortcut

Post by MSNELL »

Got it! Thank you.

Post Reply