bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29456: [PATCH] Add command for cycling between CSS color formats


From: Eli Zaretskii
Subject: bug#29456: [PATCH] Add command for cycling between CSS color formats
Date: Mon, 27 Nov 2017 19:07:56 +0200

> Date: Sun, 26 Nov 2017 16:21:51 +0100
> From: Simen Heggestøyl <address@hidden>
> Cc: Tom Tromey <address@hidden>, Stefan Monnier <address@hidden>
> 
> The attached patch adds a new command 'css-cycle-color-format' to CSS
> mode, for cycling between color formats (e.g. "black" => "#000000" =>
> "rgb(0, 0, 0)" => "black"), bound to 'C-c C-f'.

Thanks.

These functions are confusingly similar to, but subtly different from,
the similar functions in color.el, and in general the whole system of
color conversions used by Emacs for its display needs.  Here's a
tell-tale example:

    (css--web-color-to-4-dpc "#fff")
      => "#ffffffffffff"
but
    (apply 'color-rgb-to-hex (color-name-to-rgb "#fff"))
      => "#f0f0f0f0f0f0"

The latter follows the X color definitions, so why does css-mode.el
need a different interpretation of the hex-RGB notation?

My fear is that someone will mix css-mode functions with those from
elsewhere in Emacs, and will bump into confusing and contradicting
results.  Is it possible to avoid that?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]