[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 65948fc 053/348: colir.el (colir-parse-color): Fix color p
From: |
Oleh Krehel |
Subject: |
[elpa] master 65948fc 053/348: colir.el (colir-parse-color): Fix color parsing in terminal |
Date: |
Sat, 8 Apr 2017 11:03:23 -0400 (EDT) |
branch: master
commit 65948fc3a703a646600b0c0d6b221597a1759a59
Author: Pavel Aslanov <address@hidden>
Commit: Oleh Krehel <address@hidden>
colir.el (colir-parse-color): Fix color parsing in terminal
Built-in color-name-to-rgb function is not working properly in terminal
as it maps parsed color to colosest available color from available
palette, and it is done before blending. This changes basically
adds function which basiacally parses color in # prefixed format,
and fallbacks to color-name-to-rgb otherwise.
Fixes #541
Fixes #543
---
colir.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/colir.el b/colir.el
index 792033f..26ebc22 100644
--- a/colir.el
+++ b/colir.el
@@ -69,6 +69,15 @@ C1 and C2 are triples of floats in [0.0 1.0] range."
colir-compose-method)
c1 c2)))
+(defun colir-color-parse (color)
+ "Convert string COLOR to triple of floats in [0.0 1.0]."
+ (if (string-match
"#\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)"
color)
+ (mapcar (lambda (v) (/ (string-to-number v 16) 255.0))
+ (list (match-string 1 color) (match-string 2 color)
(match-string 3 color)))
+ ;; does not work properly in terminal (maps color to nearest color
+ ;; from available color palette).
+ (color-name-to-rgb color)))
+
(defun colir-blend-face-background (start end face &optional object)
"Append to the face property of the text from START to END the face FACE.
When the text already has a face with a non-plain background,
@@ -89,8 +98,8 @@ See also `font-lock-append-text-property'."
(if background-prev
(cons `(background-color
. ,(colir-blend
- (color-name-to-rgb background-prev)
- (color-name-to-rgb (face-background face nil
t))))
+ (colir-color-parse background-prev)
+ (colir-color-parse (face-background face nil
t))))
prev)
(list face prev))
object)))
- [elpa] master f57e2fb 039/348: ivy.el (ivy-immediate-done): Update docstring, (continued)
- [elpa] master f57e2fb 039/348: ivy.el (ivy-immediate-done): Update docstring, Oleh Krehel, 2017/04/08
- [elpa] master 4f57a3a 041/348: Add forth-block-mode, Oleh Krehel, 2017/04/08
- [elpa] master db94a12 043/348: ivy.el (ivy-completion-in-region): Fix double insert bug, Oleh Krehel, 2017/04/08
- [elpa] master de91a77 042/348: swiper.el (swiper-occur): Add require, Oleh Krehel, 2017/04/08
- [elpa] master fabcdc0 004/348: doc/Changelog.org: Add custom ids and whitespace in the end, Oleh Krehel, 2017/04/08
- [elpa] master c30a6e2 046/348: ivy.el (ivy-minibuffer-map): Undo remap, Oleh Krehel, 2017/04/08
- [elpa] master 3e1a940 045/348: counsel.el: Fix byte compile warnings, Oleh Krehel, 2017/04/08
- [elpa] master c960de5 047/348: counsel.el (counsel-grep-or-swiper): Don't grep on compressed files, Oleh Krehel, 2017/04/08
- [elpa] master 2776358 059/348: Show current value of the variable in the prompt, Oleh Krehel, 2017/04/08
- [elpa] master beee0b7 048/348: counsel.el (counsel-git): Add better error message, Oleh Krehel, 2017/04/08
- [elpa] master 65948fc 053/348: colir.el (colir-parse-color): Fix color parsing in terminal,
Oleh Krehel <=
- [elpa] master e987cef 061/348: counsel.el (counsel-read-setq-expression): Fix Eldoc nag, Oleh Krehel, 2017/04/08
- [elpa] master 0091c8a 058/348: ivy.el (ivy-set-prompt-text-properties-function): New devar, Oleh Krehel, 2017/04/08
- [elpa] master 473c595 064/348: Facilitate the sorting of cons cell input to ivy-read, Oleh Krehel, 2017/04/08
- [elpa] master 23bd7a4 075/348: counsel.el (counsel-git): Add :caller, Oleh Krehel, 2017/04/08
- [elpa] master 74358c2 070/348: Purge all dependency on helm-rhythmbox, Oleh Krehel, 2017/04/08
- [elpa] master 56aa605 076/348: ivy.el (ivy-add-prompt-count): Refactor from ivy--reset-state, Oleh Krehel, 2017/04/08
- [elpa] master 9c01abf 003/348: doc/Changelog.org: Add hlines, Oleh Krehel, 2017/04/08
- [elpa] master e53f256 087/348: ivy.el (ivy-minibuffer-map): Move ivy-toggle-regexp-quote from "M-q" to "M-r", Oleh Krehel, 2017/04/08
- [elpa] master af5f097 108/348: counsel.el (counsel-locate-action-extern): Make interactive, Oleh Krehel, 2017/04/08
- [elpa] master 0028c8c 106/348: counsel.el (counsel-outline): New command, Oleh Krehel, 2017/04/08