From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/74223 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.gnus.general Subject: Re: Colour manipulation Date: Sun, 21 Nov 2010 19:55:23 +0100 Message-ID: <8739quh5gk.fsf@keller.adm.naquadah.org> References: <87pquvldcs.fsf@lifelogs.com> <87oc9yp21w.fsf@lifelogs.com> <87lj4pmgu7.fsf@keller.adm.naquadah.org> <87oc9ihjbk.fsf@keller.adm.naquadah.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1290365782 5333 80.91.229.12 (21 Nov 2010 18:56:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Nov 2010 18:56:22 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M22588@lists.math.uh.edu Sun Nov 21 19:56:18 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PKF5F-00053G-Ki for ding-account@gmane.org; Sun, 21 Nov 2010 19:56:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PKF4z-0006RA-5R; Sun, 21 Nov 2010 12:56:01 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PKF4x-0006Qz-W7 for ding@lists.math.uh.edu; Sun, 21 Nov 2010 12:56:00 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PKF4w-0003TE-LK for ding@lists.math.uh.edu; Sun, 21 Nov 2010 12:55:59 -0600 Original-Received: from prometheus.naquadah.org ([212.85.154.174] helo=mx1.naquadah.org) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PKF4v-0004XU-00 for ; Sun, 21 Nov 2010 19:55:57 +0100 Original-Received: by mx1.naquadah.org (Postfix, from userid 8) id DB87A5C199; Sun, 21 Nov 2010 19:55:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on prometheus.naquadah.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Original-Received: from keller.adm.naquadah.org (unknown [IPv6:2a01:e35:2e39:e900:222:faff:fe9d:ce44]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id DFA375C137 for ; Sun, 21 Nov 2010 19:55:24 +0100 (CET) Original-Received: from jd by keller.adm.naquadah.org with local (Exim 4.72) (envelope-from ) id 1PKF4N-00038B-WE for ding@gnus.org; Sun, 21 Nov 2010 19:55:24 +0100 Mail-Followup-To: ding@gnus.org In-Reply-To: (Lars Magne Ingebrigtsen's message of "Sun, 21 Nov 2010 19:38:30 +0100") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:74223 Archived-At: On Sun, Nov 21 2010, Lars Magne Ingebrigtsen wrote: > To bikeshed a bit, color.el is kinda very general name. Perhaps > color-calc.el or something would be better... and the Greek characters > in the source code is probably not very distribution-friendly. > > Could you fix those things, and then check it into the Gnus repository? Sure I can. It's not meant to be distributed as it is anyway. I suggest you try to use it before I spend some time making it Gnus-distributable. :) >> Here's a snippet you can use to test it after loading color.el > > My use case would be that I have a set background colour (eg., "black"), > and then the CSS says "text-color: blue". I then want to modify the > latter to be a colour that is visible enough to read. How would I do > that? Hum the easiest way would be to convert RGB to Lab and then change L, a or b. To have a good understanding of how colors are represented in Lab, just take a look at the Wikipedia[1] page, the image are pretty explicit. There's no easy way to know by how much you should increase L, a or b, or what would be the best choice. FWIW L is always between 0 and 100, and there's a good chance that just changing it to 0 or 100 (depending on the other color L value) would give for sure a good result. One has to try. I did not write any lab->rgb function, but that's totally doable if needed. :) [1] http://en.wikipedia.org/wiki/Lab_color_space --=20 Julien Danjou // =E1=90=B0 http://julien.danjou.info