Message Boards Message Boards


Color palette for text?

Posted 4 months ago
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 4 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:

   {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:


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

If interested in learning more about the colorPasteButton see:

Posted 4 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
or Discard

Group Abstract Group Abstract