Changes

Jump to navigation Jump to search
1,509 bytes added ,  08:41, 23 July 2023
no edit summary
|}
= Tips and Tricks =
 
== Calculating RGB Values ==
 
An example of how to use LMTX to calculate RGB values is the following:
 
<texcode>
% Use a color picker to get red, green and blue values of a color.
% Example: RAL 2005: red = 255, green = 35, blue = 1
% Create variables from the values.
 
\setvariables[ColorName][r=255,g=35,b=1]
 
% Do some magic:
 
\usemodule[mathfun]
\def\RED{\mathexpr[.3N]{\getvariable{ColorName}{r}/255}}
\def\GREEN{\mathexpr[.3N]{\getvariable{ColorName}{g}/255}}
\def\BLUE{\mathexpr[.3N]{\getvariable{ColorName}{b}/255}}
 
% Define the actual color based on variables:
 
\definecolor[ColorName][r=\RED, g=\GREEN, b=\BLUE]
 
% Test it:
 
\startTEXpage[offset=5mm]
Hello \framed[background=color,backgroundcolor=ColorName]{WORLD}!
\\
Red: \RED\\
Green: \GREEN\\
Blue: \BLUE
\stopTEXpage
</texcode>
 
<context>
% Use a color picker to get red, green and blue values of a color.
% Example: RAL 2005: red = 255, green = 35, blue = 1
% Create variables from the values.
 
\setvariables[ColorName][r=255,g=35,b=1]
 
% Do some magic:
 
\usemodule[mathfun]
\def\RED{\mathexpr[.3N]{\getvariable{ColorName}{r}/255}}
\def\GREEN{\mathexpr[.3N]{\getvariable{ColorName}{g}/255}}
\def\BLUE{\mathexpr[.3N]{\getvariable{ColorName}{b}/255}}
 
% Define the actual color based on variables:
 
\definecolor[ColorName][r=\RED, g=\GREEN, b=\BLUE]
 
% Test it:
 
\startTEXpage[offset=5mm]
Hello \framed[background=color,backgroundcolor=ColorName]{WORLD}!
\\
Red: \RED\\
Green: \GREEN\\
Blue: \BLUE
\stopTEXpage
</context>
= Further reading and specialized topics =
194

edits

Navigation menu