;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. #@168 Copy of LIST with color names canonicalized. LIST is a list of color names (strings). Canonical names are lowercase, with no whitespace. There are no duplicate names. (defalias 'hexrgb-canonicalize-defined-colors #[(list) "\304\211\211\203( @\305\n\227\306\nG#\211 \235\204\n B \210 A\211\204\n \237+\207" [list new this tail nil hexrgb-delete-whitespace-from-string 0] 5 (#$ . 88)]) #@313 Remove whitespace from substring of STRING from FROM to TO. If FROM is nil, then start at the beginning of STRING (FROM = 0). If TO is nil, then end at the end of STRING (TO = length of STRING). FROM and TO are zero-based indexes into STRING. Character FROM is affected (possibly deleted). Character TO is not. (defalias 'hexrgb-delete-whitespace-from-string #[(string &optional from to) "\206\306 \206\f\nG\307\310\311\"r q\210\312\216\nc\210e\\b\210\313m\204G W\203G\313f\211\314>\203>\315\316!\210\202A\316u\210 T\202$\317 -\207" [from to string #1=#:temp-buffer char count 0 generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] nil (32 9 10) delete-char 1 buffer-string] 4 (#$ . 491)]) #@31 List of all supported colors. (defconst hexrgb-defined-colors nil (#$ . 1250)) #@101 List of all supported color names, with no duplicates. Names are all lowercase, without any spaces. (defconst hexrgb-defined-colors-no-dups nil (#$ . 1336)) #@199 Alist of all supported color names, for use in completion. See also `hexrgb-defined-colors-no-dups-alist', which is the same thing, but without any duplicates, such as "light blue" and "LightBlue". (defconst hexrgb-defined-colors-alist nil (#$ . 1500)) #@118 Alist of all supported color names, with no duplicates, for completion. Names are all lowercase, without any spaces. (defconst hexrgb-defined-colors-no-dups-alist nil (#$ . 1760)) #@149 *Non-nil means remove duplicate color names. Names are considered duplicates if they are the same when abstracting from whitespace and letter case. (custom-declare-variable 'hexrgb-canonicalize-defined-colors-flag t '(#$ . -1947) :type 'boolean :group 'Icicles :group 'doremi-frame-commands :group 'faces :group 'convenience) #@168 List of supported color names. If `hexrgb-canonicalize-defined-colors-flag' is non-nil, then names are lowercased, whitespace is removed, and there are no duplicates. (defalias 'hexrgb-defined-colors #[nil "\203 \207\n\207" [hexrgb-canonicalize-defined-colors-flag hexrgb-defined-colors-no-dups hexrgb-defined-colors] 1 (#$ . 2280)]) #@193 Alist of supported color names. Usable for completion. If `hexrgb-canonicalize-defined-colors-flag' is non-nil, then names are lowercased, whitespace is removed, and there are no duplicates. (defalias 'hexrgb-defined-colors-alist #[nil "\203 \207\n\207" [hexrgb-canonicalize-defined-colors-flag hexrgb-defined-colors-no-dups-alist hexrgb-defined-colors-alist] 1 (#$ . 2624)]) #@2101 Read a color name or RGB hex value: #RRRRGGGGBBBB. Completion is available for color names, but not for RGB hex strings. If you input an RGB hex string, it must have the form #XXXXXXXXXXXX or XXXXXXXXXXXX, where each X is a hex digit. The number of Xs must be a multiple of 3, with the same number of Xs for each of red, green, and blue. The order is red, green, blue. Color names that are normally considered equivalent are canonicalized: They are lowercased, whitespace is removed, and duplicates are eliminated. E.g. "LightBlue" and "light blue" are both replaced by "lightblue". If you do not want this behavior, but want to choose names that might contain whitespace or uppercase letters, then customize option `hexrgb-canonicalize-defined-colors-flag' to nil. In addition to standard color names and RGB hex values, the following are available as color candidates. In each case, the corresponding color is used. * `*copied foreground*' - last copied foreground, if available * `*copied background*' - last copied background, if available * `*mouse-2 foreground*' - foreground where you click `mouse-2' * `*mouse-2 background*' - background where you click `mouse-2' * `*point foreground*' - foreground under the cursor * `*point background*' - background under the cursor (You can copy a color using eyedropper commands such as `eyedrop-pick-foreground-at-mouse'.) Checks input to be sure it represents a valid color. If not, raises an error (but see exception for empty input with non-nil ALLOW-EMPTY-NAME-P). Interactively, or with optional arg CONVERT-TO-RGB-P non-nil, converts an input color name to an RGB hex string. Returns the RGB hex string. Optional arg ALLOW-EMPTY-NAME-P controls what happens if you enter an empty color name (that is, you just hit `RET'). If non-nil, then `hexrgb-read-color' returns an empty color name, "". If nil, then it raises an error. Programs must test for "" if ALLOW-EMPTY-NAME-P is non-nil. They can then perform an appropriate action in case of empty input. Optional arg PROMPT is the prompt. Nil means use a default prompt. (defalias 'hexrgb-read-color #[(&optional convert-to-RGB-p allow-empty-name-p prompt) "\306\307\310!\203\311 \205\312\n\205\313\314\315 $\202\315 \316\f\206#\317 \"\320+\307\310!\203~ \321\230\203: \202~ \322\230\203E\n\202~ \323\230\203Q\310 \202~ \324\230\203]\325 \202~ \326\230\203o\327\330\331!!\330 \210\202~ \332\230\203~\333\330\334!!\330 \210\335\336 \"\206\215\335\337 \"\205\215\306+,\203\236 \340\230\203\236\340\202\346+\203\256+\341=\204\256\342 P+\204\333 \340\230\204\315\307\343!\203\306\343 \"\202\312\344 \"\204\322\345\346 \"\210-\203\333\347 !\350 \203\345\351\352 \"\210 ,\207" [completion-ignore-case eyedrop-picked-foreground eyedrop-picked-background colors prompt color t fboundp eyedrop-foreground-at-point append (("*copied foreground*")) (("*copied background*")) (("*mouse-2 foreground*") ("*mouse-2 background*") ("*point foreground*") ("*point background*")) hexrgb-defined-colors-alist completing-read "Color (name or #R+G+B+): " nil "*copied foreground*" "*copied background*" "*point foreground*" "*point background*" eyedrop-background-at-point "*mouse-2 foreground*" eyedrop-foreground-at-mouse read-event "Click `mouse-2' to choose foreground color - " "*mouse-2 background*" eyedrop-background-at-mouse "Click `mouse-2' to choose background color - " string-match "^#\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" "^\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" "" 0 "#" test-completion try-completion error "No such color: %S" hexrgb-color-name-to-hex interactive-p message "Color: `%s'" hex-string allow-empty-name-p convert-to-RGB-p] 5 (#$ . 3012) "p"]) #@352 Non-nil if COLOR is an RGB string #XXXXXXXXXXXX. Each X is a hex digit. The number of Xs must be a multiple of 3, with the same number of Xs for each of red, green, and blue. Non-nil optional arg LAXP means that the initial `#' is optional. In that case, for a valid string of hex digits: when # is present 0 is returned; otherwise, t is returned. (defalias 'hexrgb-rgb-hex-string-p #[(color &optional laxp) "\302\303\"\206 \205\302\304\"\205\305\207" [color laxp string-match "^#\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" "^\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" t] 3 (#$ . 6763)]) #@51 Return the color that is the complement of COLOR. (defalias 'hexrgb-complement #[(color) "\304!\305!\306!\307!\310\311 Z\311\nZ\311 Z#+\312 \203'\313\314\"\210\207" [color blue green red hexrgb-color-name-to-hex hexrgb-red hexrgb-green hexrgb-blue hexrgb-rgb-to-hex 1.0 interactive-p message "Complement: `%s'"] 5 (#$ . 7367) (list (hexrgb-read-color))]) #@125 Return the hue component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-hue #[(color) "\301!\302\303!\304!\305!#@\207" [color hexrgb-color-name-to-hex hexrgb-rgb-to-hsv hexrgb-red hexrgb-green hexrgb-blue] 5 (#$ . 7741) (list (hexrgb-read-color))]) #@132 Return the saturation component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-saturation #[(color) "\301!\302\303!\304!\305!#A@\207" [color hexrgb-color-name-to-hex hexrgb-rgb-to-hsv hexrgb-red hexrgb-green hexrgb-blue] 5 (#$ . 8072) (list (hexrgb-read-color))]) #@127 Return the value component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-value #[(color) "\301!\302\303!\304!\305!#AA@\207" [color hexrgb-color-name-to-hex hexrgb-rgb-to-hsv hexrgb-red hexrgb-green hexrgb-blue] 5 (#$ . 8418) (list (hexrgb-read-color))]) #@125 Return the red component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-red #[(color) "\301!\302\303GS\304\245TO!\305\306GS\307\245\"\245\207" [color hexrgb-color-name-to-hex hexrgb-hex-to-int 1 3 expt 16.0 3.0] 5 (#$ . 8755) (list (hexrgb-read-color))]) #@127 Return the green component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-green #[(color) "\303!\211GS\304\245\211T\305\n\211 \\O!\306\307GS\310\245\"\245*\207" [color len start hexrgb-color-name-to-hex 3 hexrgb-hex-to-int expt 16.0 3.0] 6 (#$ . 9092) (list (hexrgb-read-color))]) #@126 Return the blue component of COLOR, in range 0 to 1 inclusive. COLOR is a color name or hex RGB string that starts with "#". (defalias 'hexrgb-blue #[(color) "\303!\211GS\304\245\211T \\\305\n\211 \\O!\306\307GS\310\245\"\245*\207" [color len start hexrgb-color-name-to-hex 3 hexrgb-hex-to-int expt 16.0 3.0] 6 (#$ . 9456) (list (hexrgb-read-color))]) #@182 Convert RED, GREEN, BLUE components to HSV (hue, saturation, value). Each input component is 0.0 to 1.0, inclusive. Returns a list of HSV components of value 0.0 to 1.0, inclusive. (defalias 'hexrgb-rgb-to-hsv #[(red green blue) " ^\n^ ]\n]\211\f Z\306\211\307\310\"\203*\310\211\202\262\31119\f\245\2110\202=\210\202\254\203\254\312W\204N\211U\203\254\307\310\"\203_\310\211\202\262\307\f\"\203o \nZ\245\202\211\307 \f\"\203\201\313\nZ\245\\\202\211\314 Z\245\\\211\315\245\211\310W\203\234\316\\\316V\203\262\316Z\202\262\310\211 E.\207" [red green blue min max value nil hexrgb-approx-equal 0.0 (arith-error) 21 2.0 4.0 6.0 1.0 delta hue saturation emacs-major-version] 4 (#$ . 9821)]) #@182 Convert HUE, SATURATION, VALUE components to RGB (red, green, blue). Each input component is 0.0 to 1.0, inclusive. Returns a list of RGB components of value 0.0 to 1.0, inclusive. (defalias 'hexrgb-hsv-to-rgb #[(hue saturation value) "\306\211\211\211\211\211\211\211\211 \307\310\"\203, \202\256\311_\312! Z\313Z_\313\f_Z_\313\313 ZZ_Z_ \314\267\202\244  \202\256\n  \202\256  \202\256 \n \202\256  \202\256 \n  E. \207" [ww tt qq pp fract int-hue nil hexrgb-approx-equal 0.0 6.0 floor 1 #s(hash-table size 6 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (0 99 6 99 1 112 2 125 3 138 4 151)) blue green red saturation value hue] 9 (#$ . 10597)]) #@159 Return the hex RBG color string for inputs HUE, SATURATION, VALUE. The inputs are each in the range 0 to 1. The output string is of the form "#RRRRGGGGBBBB". (defalias 'hexrgb-hsv-to-hex #[(hue saturation value) "\303\304\305\306 \n#\"!\207" [hue saturation value hexrgb-color-values-to-hex mapcar #[(x) "\301\302_!\207" [x floor 65535.0] 3] hexrgb-hsv-to-rgb] 7 (#$ . 11379)]) #@153 Return the hex RBG color string for inputs RED, GREEN, BLUE. The inputs are each in the range 0 to 1. The output string is of the form "#RRRRGGGGBBBB". (defalias 'hexrgb-rgb-to-hex #[(red green blue) "\303\304\305 \nE\"!\207" [red green blue hexrgb-color-values-to-hex mapcar #[(x) "\301\302_!\207" [x floor 65535.0] 3]] 6 (#$ . 11766)]) #@268 Return a list of HSV (hue, saturation, value) color components. Each component is a value from 0.0 to 1.0, inclusive. COLOR is a color name or a hex RGB string that starts with "#" and is followed by an equal number of hex digits for red, green, and blue components. (defalias 'hexrgb-hex-to-hsv #[(color) "\302!\303\304 \")\207" [color rgb-components hexrgb-hex-to-rgb apply hexrgb-rgb-to-hsv] 3 (#$ . 12113)]) #@262 Return a list of RGB (red, green, blue) color components. Each component is a value from 0.0 to 1.0, inclusive. COLOR is a color name or a hex RGB string that starts with "#" and is followed by an equal number of hex digits for red, green, and blue components. (defalias 'hexrgb-hex-to-rgb #[(color) "\302!\204\n\303!GS\304\245\305\306 TO!\307\245\305 T T \\O!\307\245\305 T \\\310O!\307\245E)\207" [color len hexrgb-rgb-hex-string-p hexrgb-color-name-to-hex 3 hexrgb-hex-to-int 1 65535.0 nil] 6 (#$ . 12534)]) #@135 Return the RGB hex string for the COLOR name, starting with "#". If COLOR is already a string starting with "#", then just return it. (defalias 'hexrgb-color-name-to-hex #[(color) "\302!\211\204 \303\304\"\210\305!\204\306 !)\207" [color components x-color-values error "No such color: %S" hexrgb-rgb-hex-string-p hexrgb-color-values-to-hex] 4 (#$ . 13061)]) #@166 Convert list of rgb color VALUES to a hex string, #XXXXXXXXXXXX. Each X in the string is a hexadecimal digit. Input VALUES is as for the output of `x-color-values'. (defalias 'hexrgb-color-values-to-hex #[(values) "\301\302@\303\"\302A@\303\"\302\3048\303\"R\207" [values "#" hexrgb-int-to-hex 4 2] 6 (#$ . 13436)]) #@212 Convert hex COLOR to a list of rgb color values. COLOR is a hex rgb color string, #XXXXXXXXXXXX Each X in the string is a hexadecimal digit. There are 3N X's, N > 0. The output list is as for `x-color-values'. (defalias 'hexrgb-hex-to-color-values #[(color) "\306\307\"\310\224\310\225=\203G\202GS\311\245\312\211\312 \204'\313\314\"\210\315\224\315\225O\316\317\nO!\316\n\315\n_O!\316\n\311\n_O! \f E-\207" [color hex-strgp ndigits red green blue string-match "^\\(#\\)?\\(\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+\\)$" 1 3 nil error "Invalid RGB color string: %s" 2 hexrgb-hex-to-int 0] 6 (#$ . 13762)]) #@283 Increment red value of rgb string HEX by INCREMENT. String HEX starts with "#". Each color is NB-DIGITS hex digits long. If optional arg WRAP-P is non-nil, then the result wraps around zero. For example, incrementing "#FFFFFFFFF" by 1 will cause it to wrap around to "#000000000". (defalias 'hexrgb-increment-red #[(hex nb-digits increment &optional wrap-p) "\304\305\306 TO\n $ T \307_TO \307_T\310OR\207" [hex nb-digits increment wrap-p "#" hexrgb-increment-hex 1 2 nil] 6 (#$ . 14397)]) #@215 Increment green value of rgb string HEX by INCREMENT. String HEX starts with "#". Each color is NB-DIGITS hex digits long. For example, incrementing "#FFFFFFFFF" by 1 will cause it to wrap around to "#000000000". (defalias 'hexrgb-increment-green #[(hex nb-digits increment &optional wrap-p) "\304\305 TO\306 T \307_TO\n $ \307_T\310OR\207" [hex nb-digits increment wrap-p "#" 1 hexrgb-increment-hex 2 nil] 7 (#$ . 14899)]) #@214 Increment blue value of rgb string HEX by INCREMENT. String HEX starts with "#". Each color is NB-DIGITS hex digits long. For example, incrementing "#FFFFFFFFF" by 1 will cause it to wrap around to "#000000000". (defalias 'hexrgb-increment-blue #[(hex nb-digits increment &optional wrap-p) "\304\305 \306_TO\307 \306_T\310O\n $Q\207" [hex nb-digits increment wrap-p "#" 1 2 hexrgb-increment-hex nil] 7 (#$ . 15335)]) #@228 Increment each color value (r,g,b) of rgb string HEX by INCREMENT. String HEX starts with "#". Each color is NB-DIGITS hex digits long. For example, incrementing "#FFFFFFFFF" by 1 will cause it to wrap around to "#000000000". (defalias 'hexrgb-increment-equal-rgb #[(hex nb-digits increment &optional wrap-p) "\304\305\306 TO\n $\305 T \307_TO\n $\305 \307_T\310O\n $R\207" [hex nb-digits increment wrap-p "#" hexrgb-increment-hex 1 2 nil] 8 (#$ . 15763)]) #@150 Increment HEX number (a string NB-DIGITS long) by INCREMENT. For example, incrementing "FFFFFFFFF" by 1 will cause it to wrap around to "000000000". (defalias 'hexrgb-increment-hex #[(hex increment nb-digits &optional wrap-p) "\306!\n \\\f\204\" \307Y\203) \307Y\203)\310\311 \"G X\203)\312 \"\202**\207" [hex int increment new-int wrap-p nb-digits hexrgb-hex-to-int 0 format "%X" hexrgb-int-to-hex] 3 (#$ . 16234)]) #@90 Convert HEX string argument to an integer. The characters of HEX must be hex characters. (defalias 'hexrgb-hex-to-int #[(hex) "\305 G\211S\306 \306Y\203$\f\307 H!_\\ S\310_\202\n\f,\207" [factor hex len indx int 1 0 hexrgb-hex-char-to-integer 16] 6 (#$ . 16667)]) #@66 Take a CHARACTER and return its value as if it were a hex digit. (defalias 'hexrgb-hex-char-to-integer #[(character) "\302Y\203\303X\203\302Z\207\304\305\"\211\306Y\203' \307X\203' \310Z\202+\311\312 \")\207" [character ch 48 57 logior 32 97 102 87 error "Invalid hex digit `%c'"] 4 (#$ . 16949)]) #@391 Convert integer argument INT to a #XXXXXXXXXXXX format hex string. Each X in the output string is a hexadecimal digit. NB-DIGITS is the number of hex digits. If INT is too large to be represented with NB-DIGITS, then the result is truncated from the left. So, for example, INT=256 and NB-DIGITS=2 returns "00", since the hex equivalent of 256 decimal is 100, which is more than 2 digits. (defalias 'hexrgb-int-to-hex #[(int &optional nb-digits) "\206\302\303\304\305!\306Q \"[\307O\207" [nb-digits int 4 format "%0" int-to-string "X" nil] 4 (#$ . 17266)]) #@321 Return non-nil if numbers X and Y are approximately equal. RFUZZ is a relative fuzz factor. AFUZZ is an absolute fuzz factor. RFUZZ defaults to 1.0e-8. AFUZZ defaults to (/ RFUZZ 10). RFUZZ and AFUZZ are converted to their absolute values. The algorithm is: (< (abs (- X Y)) (+ AFUZZ (* RFUZZ (+ (abs X) (abs Y))))). (defalias 'hexrgb-approx-equal #[(x y &optional rfuzz afuzz) "\206\304\305! \206\306\245\305 !\305\n Z! \305\n!\305 !\\_\\W\207" [rfuzz afuzz x y 1e-08 abs 10] 6 (#$ . 17837)]) #@126 Return the floating-point equivalent of color value N. N must be an integer between 0 and 65535, or else an error is raised. (defalias 'hexrgb-color-value-to-float #[(n) "\301!\203\f\302X\204\303\304!\210\305!\306\245\207" [n wholenump 65535 error "Not a whole number less than 65536" float 65535.0] 2 (#$ . 18353)]) #@122 Return the color value equivalent of floating-point number X. X must be between 0.0 and 1.0, or else an error is raised. (defalias 'hexrgb-float-to-color-value #[(x) "\247\203\301X\203\302X\204\303\304!\210\305\306_!\207" [x 0.0 1.0 error "Not a floating-point number between 0.0 and 1.0" floor 65535.0] 3 (#$ . 18683)]) (provide 'hexrgb)