From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80522 Path: news.gmane.org!not-for-mail From: Devendra Ghate Newsgroups: gmane.comp.tex.context Subject: Consistent Colors Date: Tue, 29 Jan 2013 13:41:36 +0530 Message-ID: <51078438.5080009@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1359447107 20501 80.91.229.3 (29 Jan 2013 08:11:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jan 2013 08:11:47 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jan 29 09:12:05 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U06IW-0001ok-MP for gctc-ntg-context-518@m.gmane.org; Tue, 29 Jan 2013 09:12:04 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A367610208; Tue, 29 Jan 2013 09:11:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id KeCPOVrYavOH; Tue, 29 Jan 2013 09:11:45 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4C510101F7; Tue, 29 Jan 2013 09:11:45 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 76719101F7 for ; Tue, 29 Jan 2013 09:11:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id M0S5IX1ckr2i for ; Tue, 29 Jan 2013 09:11:43 +0100 (CET) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id BCEFF101F5 for ; Tue, 29 Jan 2013 09:11:43 +0100 (CET) Original-Received: from mail-da0-f44.google.com (mail-da0-f44.google.com [209.85.210.44]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r0T8QrPq030719 for ; Tue, 29 Jan 2013 09:26:54 +0100 Original-Received: by mail-da0-f44.google.com with SMTP id z20so106511dae.3 for ; Tue, 29 Jan 2013 00:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=VsVZ8J39286myTJFWrg5hG5WmjY00DPsqf36ekIWhqU=; b=fGhxcp4ZLC8zljiaJiO0R9jTRmeehRHBsLMyDHHl2vmK80zMDnm3An+v+ywiCudTPt XaTogmBnSrT7YjmP3jva0cjOgH280ZGrUjenKN+LZXNoE1ghulikAkDF1BZ6j92S4P/n REO3UecQPGmfsr/5HzF+fkUefhCCL7C3ETXkyYV7C9IRhiSec5KtAKKjG2AQb2QuRCsC pCvfkqu2Lx252Wt7JKcQsUtl77uw72wTa4MV3E8GLiXBKD8/CFybIDRT/QDc/EFud6ZW VVhiaG2eH1nTMSIAA7Arfrhj0t/EFMWAiyalSSed54AbNm/I1aIurG3gktLae0QZIqcw qDbw== X-Received: by 10.66.81.68 with SMTP id y4mr536132pax.66.1359447101599; Tue, 29 Jan 2013 00:11:41 -0800 (PST) Original-Received: from [61.11.102.153] ([61.11.102.153]) by mx.google.com with ESMTPS id im5sm7952839pbc.55.2013.01.29.00.11.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Jan 2013 00:11:40 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.210.44; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01IRIqRuI - 5604fdb47b7e - 20130129 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80522 Archived-At: I have been going through the concepts underlying pallet. I would like to define three basic colors in RGB. Then use various shades and tints of these basic three colors through out the document. Now the algorithm for getting various shades for RGB scheme is: Darker shades: Multiply each component by 1/4, 1/2, 3/4, etc. of its previous value, depending on how dark the color should be. Lighter tints: Calculate (1 - previous value), multiply that by 1/4, 1/2, 3/4, etc. and add that to the previous value. What I would like is a macro that is fed a color name and should define 3 shades above and below it. I have following problems: 1. How to get RGB values of an already defined color? If this is too involved then I can pass the RGB values to the macro as well. 2. How to create a loop and carry out the above arithmatic to create RGB values for various shades? Essentially the problem boils down to doing arithmetic calculations and creating loops in ConTeXt. Regards, Devendra MWE: -------------------------- \setupcolor[rgb] \definecolor[maroon][r=0.8, g=0.2, b=0.4] %\definecolorgroup %[maroon][rgb] %[0.9:0.6:0.7, %0.8:0.2:0.4, %0.4:0.1:0.2, %0.2:0.05:0.1] % A macro that generates three shades above and below the given color. % It is assumed here that the RGB values are also passed along with % the color name. \define[4]\generateColorGroup{ \definecolorgroup [#1] [#2:#3:#4] %\dimexpr#2/4:#3/4:#4/4] }% \generateColorGroup{maroon}{0.8}{0.2}{0.4} \starttext \showcolor \stoptext ------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________