question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal for color format

See original GitHub issue

While working on #142, I’ve checked internet for documentation about how other LaTeX-related tools deal with colors. I have not found any evidence that LaTeX supports direct color definition (e.g. \color{rgb}{1.0,1.5,1.0}{mytext}) for either \color or \colorbox. Although, I’ve found a useful piece of documentation on Wikibooks.

I don’t want to add ability to define new colors in WPF-Math LaTeX documents, so I don’t want to add commands such as \definecolor. I believe that the markup should stay static at the moment and should not have any influence on itself (i.e. no macro or color or whatever definitions in markup).

So I suggest that we document and add a modified syntax for \color and \colorbox commands by adding an optional mode parameter. Full syntax will be:

\command [mode] {color} {text}

Where:

  • command is either color or colorbox
  • mode is one of gray, rgb, RGB, HTML, cmyk (for now let’s stop on that, but the code should be robust enough to add more modes: xcolor manual includes some additional modes)
  • color is either a predefined color name (as implemented already) if the mode argument wasn’t provided or a proper color definition according to the wikibooks documentation
  • additionally to the standard color definitions, we will support a transparency parameter that will be optional and should be added in a convenient manner to every mode we support

The motivation for adding transparency is clear: while LaTeX was designed to provide mostly a printed documents, we know that we’re working with display graphics in WPF-Math, and transparency could be useful and shouldn’t be too hard to implement, so I think we should add it.

Here’re some syntax samples:

\colorbox{red}{text} // already implemented, "red" is a predefined color name
\colorbox{red,0.5}{text} // predefined color with transparency
\colorbox[gray]{0.5}{text}
\colorbox[gray]{0.5, 0.5}{text} // added transparency; also note that embedded spaces should be supported
\colorbox[rgb]{0,0,0}{text}
\colorbox[rgb]{0,0,0, 0.5}{text}
\colorbox[RGB]{255,255,255}{text}
\colorbox[RGB]{255,255,255,0}{text}
\colorbox[HTML]{FFFFFF}{text}
\colorbox[HTML]{ffffff00}{text}
\colorbox[cmyk]{0,0,0,1}{text}
\colorbox[cmyk]{0,0,0,1,0.5}{text}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ForNeVeRcommented, Oct 2, 2018

@B3zaleel you’ve already implemented the core of the feature, I’ll take care of the rest, don’t bother yourself 😃

1reaction
B3zaleelcommented, Oct 2, 2018

In the command processing function, we could first check for a color model and read the next two arguments.

  • If the color model is not null, parse the first argument as a color definition with the color model in a static “ColorUtilities” class. If it is null, try the following.
  • Try to get the value of the first argument from the predefined colors.
  • Try to modify the modify the first argument using the “Color utilities” class(if given “\color{red, 0.4}{Text}”, get the predefined color, red and give it an alpha value of 0.4 ×255 “floored” ). Nothing can be done if all of the above fail.
Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide To Proposal Color Team Reviews & Ratings
Soon thereafter, you will encounter on the proposal schedule color-coded reviews: Blue, Pink, Red, Green, Gold, White, and sometimes, shades in ...
Read more >
How to Effectively Use Color in Your Business Proposals
If you want your proposal to seem bold and exciting, use reds and oranges. For example, if you are in a creative or...
Read more >
29 Sample Proposal Templates and Design Tips
Don't be afraid of color. Proposals don't always have to be a black and white, boring document. Instead, you can bring them to...
Read more >
7 Design Tweaks to Make Your Proposal Credible and ...
Most proposals start with a well-designed (and often colorful) cover page since it has little text. Beyond the cover page, you can use...
Read more >
Proposal Color Scheme » Blue » SchemeColor.com
The Proposal Color Scheme palette has 5 colors which are Maximum Yellow Red (#EEBA4B), United Nations Blue (#6081EC), Crayola's Blue-Violet (#795AC0), Deep ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found