From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82040 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Set background color for a single page Date: Tue, 23 Apr 2013 10:51:24 -0400 (EDT) Message-ID: References: , , , , 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 1366728699 12543 80.91.229.3 (23 Apr 2013 14:51:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Apr 2013 14:51:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Apr 23 16:51:41 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 1UUeZI-0001Uv-Mo for gctc-ntg-context-518@m.gmane.org; Tue, 23 Apr 2013 16:51:40 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7EB3410201; Tue, 23 Apr 2013 16:51:39 +0200 (CEST) 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 KyL0lABMfU0j; Tue, 23 Apr 2013 16:51:37 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id DFBA8101EF; Tue, 23 Apr 2013 16:51:36 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 05029101EB for ; Tue, 23 Apr 2013 16:51:36 +0200 (CEST) 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 zivg9ii1XL3d for ; Tue, 23 Apr 2013 16:51:34 +0200 (CEST) Original-Received: from filter1-utr.mf.surf.net (filter1-utr.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id 1D154101E4 for ; Tue, 23 Apr 2013 16:51:33 +0200 (CEST) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by filter1-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3NEpR5x032395 for ; Tue, 23 Apr 2013 16:51:29 +0200 Original-Received: FROM mint ((null) [70.52.113.158]) By hackers.mr.itd.umich.edu ID 51769FEE.3D593.5992 ; Authuser adityam; 23 Apr 2013 10:51:26 EDT In-Reply-To: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) X-Bayes-Prob: 0.0157 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.81; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07JrqPsSQ - bdc2592e422f - 20130423 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) 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:82040 Archived-At: > Aditya, I want to know both please. Now I use the \start \definecolor > ... ... \startmakeup[standard] ... \stopmakeup \stopto assign a > specific color to the tilepage whose content is on a single page > exactly. But I don't know how to set the background for a single page, > say, page 3 if a document has more than three pages. Also, I don't know > how to cycle pages through a finite list of colors. Can you show me > that? Tim One way to do this is to set \setupbackgrounds[page][background=color, backgroundcolor=\PageColor] and define \PageColor such that it expands to an appropriate color. For arbitrary control, you can use a lua function, for example: \startluacode thirddata = thirddata or {} function thirddata.getpagecolor(num) -- A lua function that assigns colors based on page numbers if num == 3 then context("blue") elseif num == 5 then context("red") end end \stopluacode \def\PageColor% {\ctxlua{thirddata.getpagecolor(\rawcountervalue[userpage])}} \setupbackgrounds[page][background=color, backgroundcolor=\PageColor] \setuppapersize[S3] \starttext \dorecurse{10}{\input knuth \par} \stoptext You can also use a lua table to assign colors, and then you do not have to build a ladder of if statements. Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________