Version 4 of defColor

Updated 2020-01-17 07:40:43 by APE

JayBy 2016-05-30

defColor provides procedures for color definitions, like ...

  • Tint and mix colors
  • Translate colors to #HHEEXX format
  • Search nearest name of given color
  • Takes care of additional 'SystemColors' on windows

defColor uses only RGB values for calculation.

Download

Version 0.3
defColor-0.3.zip

Usage

package require defColor ?0.3?

COMMANDS

::defColor::reverse <Color1> <Color2>
Reverse Colors
Output: list <Color2> <Color1>
::defColor::mix <BaseColor> ?<MixColor>? ?<MixValue>?
Mix <BaseColor> with <MixColor> with the strength of <MixValue> (0-100).
Defaults: <MixColor> defaults to black or white depending of Brightness of <BaseColor>. <MixValue> defaults to 50.
Output: <HexColor>
::defColor::tint <Color> ?<TintValue>?
Create lighter and darker color from given color with the strength of <TintValue> (0-100).
Defaults: <TintValue> defaults to 50.
Output: list <LighterColor> <DarkerColor>
::defColor::crFore <BackColor>
Set black or white <ForeColor> depending of <BackColor>
Output: <ForeColor>
::defColor::luminance <Color>
Calculate brightness level.
Output: <Percent>
::defColor::nearestName <Color>
Search nearest <ColorName> of <Color>
Output: list <ColorName> <Differenz>
Internal Helpers
::defColor::conv2List <Color>
::defColor::conv2Hex <Color>
::defColor::list2Hex list R G B
::defColor::conv2Perc <Color>
Old, for compatibility
::defColor::isBright <Color>
::defColor::brightLevel <Color>
::defColor::listNames
::defColor::validate <Color>

VARIABLES

::defColor::ColorNames
List of all known color names, which comes from the builtin 'rgb.txt'. Each color definition is a sublist like list <Red> <Green> <Blue> <Name> <RGB-Sum>.

Siqsuruq - 2016-05-30 16:51:17

Link is not working.

JayBy Now it should work!

APE - 2020-01-17

Link not working, finally found it in http://chiselapp.com/user/aspect/repository/tcl-hacks/artifact/b7205a7967c8c6f9