[NTG-context] Consistent Colors

2013-01-29 Thread Devendra Ghate

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
___


Re: [NTG-context] Consistent Colors

2013-01-29 Thread Devendra Ghate


On 01/29/2013 01:41 PM, Devendra Ghate wrote:

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
---

I see now that this is a trivial question. Though I was not able to
use a loop, I used \ctxlua{context(math expr.)} for floating point
arithmetic.

Devendra




___
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
___


Re: [NTG-context] ConTeXt-ifying Kile

2008-01-02 Thread Matija Šuklje
OK, it's been a fun day's work, but here's the current working version of 
the context.cwl file.

What it does include:
* all the commands with all the fields mentioned on texshow.contextgarden.net
* the rest of the commands that I used from the list Idris sent me are 
currently commented out, until I find out they're valid (although not on 
texshow)
* all the fields have short descriptions
* all the \start* commands end with appropriate \stop* commands
* some of the fields (where it was simple to do it) use a '|' character as a 
separator inside fields

What it does not include:
* a syntax completely as Kile's README.cwl would want to have (especially 
because of my misuse of \start* \stop* in the same command and Mojca's 
separator suggestion)
* a completely coherent and Kile-valid syntax is still missing, although as 
it is, the file is usable
* some commands are commented out, as mentioned above

Installation:
copy or link the file to /usr/share/apps/kile/complete/tex/ (or the 
appropriate kile/complete/tex/ directory) and add context.cwl in Kile's 
settings under Kile-Complete-TeX/LaTeX

I hope anyone finds it useful and that I manage to get it working 
perfectly/validly soon.


Cheers,
Matija

-- 
gsm: +386 41 849 552
e-mail: [EMAIL PROTECTED]
www: http://matija.suklje.name

aim: hookofsilver
icq: 110183360
jabber/g-talk: [EMAIL PROTECTED]
msn: [EMAIL PROTECTED]
yahoo: matija_suklje
# ConTeXt commands
# Matija silverhook Šuklje, 02. Jan. 2008 — [EMAIL PROTECTED]
# URL: todo

\about{text}[reference]
\adaptlayout[number][dimensions]
\adding[size]
# \aftersplitstring
# \and
\appendix[references]{text}
# \appendtoks
# \AR
\arg{text}
\at{text}{text}[reference]
\atpage[reference]
\background
# \bbox
# \beforesplitstring
# \begstrut
\blackrule[settings]
\blackrules[settings]
\blank[size]
# \blockquote
\bookmark[name]{text}
# \bTABLE
# \bTABLEbody
# \bTABLEfoot
# \bTABLEhead
# \bTABLEnext
# \bTD
# \bTH
# \bTR
\but[reference]
\button[settings]{text}[references]
\bypassblocks[names][names]
\CAP{text}
\Cap{text}
\cap{text}
\Caps{text}
\chapter[references]{text}
\Character{text}
\character{text}
\Characters{text}
\characters{text}
\chem{text}{text}{text}
\clip[settings]{text}
\clonefield[name][names][name][names]
\color[text{text}
\column
# \commalistelement
\comment[name][settings]{text}
\comparecolorgroup[name]
\comparepalet[name]
\completecombinedlist[name][settings]
\completelistoffloats
\completelistofsorts
\completelistofsynonyms
\completeregister[settings]
# \component
# \ConTeXt
# \Context
# \convertargument
# \convertcommand
\convertnumber{text}{text}
\copyfield[name][names]
\correctwhitespace{text}
# \countXMLchildren
\coupledocument[name][file][name]
\coupledregister[text]{text}
\couplemarking[name][name]
\couplepage[names][options]
\couplepaper[name]
\coupleregister[name]
\crlf
\currentdate[syntax]
\currentheadnumber
\date[date][syntax]
\decouplemarking[name]
# \decrement
\define[number]\command{text}
\defineblank[name][settings]
\defineblock[name]
\definebodyfont[font size][type][files]
\definebodyfontenvironment[font size][dimensions]
\definebuffer[name]
# \definecollector
\definecolor[name]{colour values}
\definecolorgroup[name][colour model][colour values]
\definecombinedlist[name][list][settings]
\defineconversion[name][command]
\definedescription[name][settings]
# \definedfont
\defineenumeration[names][name][settings]
# \defineexternalfigure
\definefield[reference][widget type][setup name][names][initial content]
\definefieldstack[name][names][settings]
\definefiguresymbol[name][text][settings]
\definefloat[singular][plural]
\definefont[name][file]
# \definefontsynonym
\defineframed[name][settings]
# \defineframedcontent
\defineframedtext[name][settings]
\definehead[name][section]
# \definehspace
\defineindenting[name][settings]
\defineinteractionmenu[position|names][options and settings]
\defineinteractionmenu[position|name][position|name][settings]
\definelabel[name][text and options]
# \definelayer
# \definelayerpreset
# \definelayout
\definelist[name][name][settings]
\definelogo[name][position][position][command][state]
# \definemainfield
\definemakeup[name][settings]
\definemarking[name][name]
# \definemeasure
# \defineoutput[name][specials]
\defineoverlay[names][command]
# \definepagebreak
\definepalet[name][name]
\definepapersize[name][dimenstions]
\defineparagraphs[name][options and settings]
\defineprofile[names][names]
\defineprogram[name][text][text]
# \definepushbutton
# \definepushsymbol
\definerawfont[name][file][settings]
\definereference[name][references]
\definereferenceformat[name][options]
\definereferencelist[name][settings]
\defineregister[singular][plural]
\definerule[name][settings]
\definesection[name]
\definesectionblock[name][settings]
\definesorting[singular][plural][command]
\definestartstop[name][commands]
\definesubfield[name][name][names]
\definesymbol[name][text]
\definesynonyms[singular][plural][command][command]
\definetabletemplate[name][text][text][text