Message Boards Message Boards

GROUPS:

Color palette for text?

Posted 7 months ago
1176 Views
|
2 Replies
|
3 Total Likes
|

Does anyone know how to build a color palette? To apply a color to a text, we must go to the Format, Text Color menu and click on the desired color. I would like to create a palette that would make this operation faster and more practical.

Good weekend.

2 Replies
Posted 7 months ago

This is how I do it. First define this function to that you can apply or insert a color with a single button:

colorPasteButton = Button[" ",
    ib := InputNotebook[];
    If[NotebookRead[ib] === {}, Paste[ib, #], 
     FrontEndExecute[{FrontEndToken[ib, FontColor, #]}]],
    Appearance -> "Palette", Background -> #, ImageSize -> Full] &;

Then, create your palette in the notebook, for example:

Pane[
 Grid[
  {
   {Tooltip[colorPasteButton[Black], "Black 100%"],
    Tooltip[colorPasteButton[GrayLevel[0.15]], "Black 85%"],
    Tooltip[colorPasteButton[GrayLevel[0.50]], "Black 50%"],
    Tooltip[colorPasteButton[GrayLevel[0.75]], "Black 25%"],
    Tooltip[colorPasteButton[GrayLevel[0.85]], "Black 15%"]}
   },
  ItemSize -> {2, 1}, Alignment -> Left, Spacings -> {.1, 0}],
 FrameMargins -> 5] 

Then convert it to a palette:

CreatePalette[%]

And finally go to the Palettes menu, and select "Install palette".

If interested in learning more about the colorPasteButton see: https://mathematica.stackexchange.com/questions/95243/paste-set-color-with-a-single-button-for-palettes?form=MY01SV&OCID=MY01SV

Posted 7 months ago

Thank you for your response and attention Gustavo.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract