all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Heime <heimeborgia@protonmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Returning hex value from rgb combination (each from 0 to 255)
Date: Sat, 31 Aug 2024 23:26:45 +0200	[thread overview]
Message-ID: <87o758jsdm.fsf@gmx.net> (raw)
In-Reply-To: <QmVG8v30MdvLs35alf5iXXbVxWw9MX1jcGxEp8OkWc_3vtNtjgdAvJ3aifJyI41kWgupDCGVkUMB73TtwtKifj7KG8Z30BHCs5n6q3tqTkA=@protonmail.com> (Heime's message of "Sat, 31 Aug 2024 18:44:22 +0000")

On Sat, 31 Aug 2024 18:44:22 +0000 Heime <heimeborgia@protonmail.com> wrote:

> On Sunday, September 1st, 2024 at 6:24 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Vagn Johansen gonz808@hotmail.com
>> > Date: Sat, 31 Aug 2024 19:54:49 +0200
>> >
>> > Eli Zaretskii eliz@gnu.org writes:
>> >
>> > > > Date: Sat, 31 Aug 2024 17:10:27 +0000
>> > > > From: Heime heimeborgia@protonmail.com
>> > > >
>> > > > How can I make a function that takes r g and b values (from 0 to 255) and
>> > > > returns the corresponding hex value ?
>> > >
>> > > What is "the corresponding hex value"?
>> >
>> > Probably the format used by color-rgb-to-hex
>> >
>> > (color-rgb-to-hex 1 0 0 2) => "#ff0000"
>>
>>
>> Then he had better used (color-rgb-to-hex 1 0 0) instead, as 2 digits
>> per component will get him in trouble eventually.
>
> But this requires values from 0.0 to 1.0 rather than from 0 to 255.

So define a function that takes integer RGB values between 0 and 255 and
divide them by 255.0 before passing them to color-rgb-to-hex.

Steve Berman



      reply	other threads:[~2024-08-31 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-31 17:10 Returning hex value from rgb combination (each from 0 to 255) Heime
2024-08-31 17:43 ` Eli Zaretskii
2024-08-31 17:54   ` Vagn Johansen
2024-08-31 18:24     ` Eli Zaretskii
2024-08-31 18:44       ` Heime
2024-08-31 21:26         ` Stephen Berman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o758jsdm.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.