ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* coloring rules
@ 2010-01-21 16:28 Hans van der Meer
  2010-01-21 21:24 ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Hans van der Meer @ 2010-01-21 16:28 UTC (permalink / raw)
  To: NTG ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]

ConTeXt  ver: 2010.01.19 23:29 MKIV  fmt: 2010.1.20  int: english/ 
english

Coloring hrule's and vrule's with \color[aColor]{\vrule  
heightdepthwidth} works only if aColor is one of the standardcolors  
like red, blue, gray, etc.
But defining other colors don't color the rule \definecolor[mygray][r=. 
6,g=.7,b=.7]\color[mygray]{\vrule heightdepthwidth} typesets the rule  
in black, not in mygray.
The strange is that the lines around \framed[framecolor=mygray] do get  
colored correctly.

How can I accomplish the general coloring of vrule's and hrule's?

Hans van der Meer





[-- Attachment #1.2: Type: text/html, Size: 1934 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-21 16:28 coloring rules Hans van der Meer
@ 2010-01-21 21:24 ` Aditya Mahajan
  2010-01-23 13:32   ` Hans van der Meer
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2010-01-21 21:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 21 Jan 2010, Hans van der Meer wrote:

> ConTeXt  ver: 2010.01.19 23:29 MKIV  fmt: 2010.1.20  int: english/english
>
> Coloring hrule's and vrule's with \color[aColor]{\vrule heightdepthwidth} 
> works only if aColor is one of the standardcolors like red, blue, gray, etc.
> But defining other colors don't color the rule 
> \definecolor[mygray][r=.6,g=.7,b=.7]\color[mygray]{\vrule heightdepthwidth} 
> typesets the rule in black, not in mygray.
> The strange is that the lines around \framed[framecolor=mygray] do get 
> colored correctly.
>
> How can I accomplish the general coloring of vrule's and hrule's?

\blackrules.

%D \macros
%D   {blackrules}
%D
%D One can call for a sequence of black rules, if needed
%D equally spaced over the given width.
%D
%D \showsetup{blackrules}
%D
%D The two alternative calls are therefore:
%D
%D \startbuffer
%D Tell me, is this according to the \blackrules[n=6]?
%D These \blackrules[alternativevariant=b,n=10,distance=.2em,width=4cm] 
are quite clear.
%D \stopbuffer


Despite its name, \blackrules can be of any color. The default options are

\setupblackrules
   [\c!n=3,
    \c!width=1em,
    \c!height=1ex,
    \c!depth=\!!zeropoint,
    \c!alternative=\c!a,
    \c!distance=.25ex,
    \c!color=]

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-21 21:24 ` Aditya Mahajan
@ 2010-01-23 13:32   ` Hans van der Meer
  2010-01-23 13:49     ` Wolfgang Schuster
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hans van der Meer @ 2010-01-23 13:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Further experimentation has shown that it is not impossible to color  
\vrule's, thus \blackrule is not specifically needed. Let me first  
mention that I put the colored rules away with \setbox\B=\hbox{} and  
then later call \B up. It is a pity until now I am not able to concoct  
a minimal example showing consistently the behaviour.

However I have made the following observations:
define: \definecolor[mycolor][r=myR,g=myG,b=myB]

(1) \color[mycolor]{rule} typesets a black rule
(2) \color[red]{something}\color[mycolor]{rule} typesets a mycolor rule
(3) \definecolor[green][r=myR,g=myG,b=myB]\color[mycolor]{rule}  
typesets a mycolor rule
(4) changing the values of myR,myG,myB between runs keeps typesetting  
the old mycolor
(5) it seems there is a memory effect on defined colors, something  
with a cache that keeps me from changing things.

It is mainly the seemingly erratic behaviour of the color changes that  
puzzles me. I seem not being able to pinpoint a culprit.

Hans van der Meer


On 21 jan 2010, at 22:24, Aditya Mahajan wrote:

> On Thu, 21 Jan 2010, Hans van der Meer wrote:
>
>> ConTeXt  ver: 2010.01.19 23:29 MKIV  fmt: 2010.1.20  int: english/ 
>> english
>>
>> Coloring hrule's and vrule's with \color[aColor]{\vrule  
>> heightdepthwidth} works only if aColor is one of the standardcolors  
>> like red, blue, gray, etc.
>> But defining other colors don't color the rule \definecolor[mygray] 
>> [r=.6,g=.7,b=.7]\color[mygray]{\vrule heightdepthwidth} typesets  
>> the rule in black, not in mygray.
>> The strange is that the lines around \framed[framecolor=mygray] do  
>> get colored correctly.
>>
>> How can I accomplish the general coloring of vrule's and hrule's?
>
> \blackrules.
>
> %D \macros
> %D   {blackrules}
> %D
> %D One can call for a sequence of black rules, if needed
> %D equally spaced over the given width.
> %D
> %D \showsetup{blackrules}
> %D
> %D The two alternative calls are therefore:
> %D
> %D \startbuffer
> %D Tell me, is this according to the \blackrules[n=6]?
> %D These \blackrules[alternativevariant=b,n=10,distance=. 
> 2em,width=4cm] are quite clear.
> %D \stopbuffer
>
>
> Despite its name, \blackrules can be of any color. The default  
> options are
>
> \setupblackrules
>  [\c!n=3,
>   \c!width=1em,
>   \c!height=1ex,
>   \c!depth=\!!zeropoint,
>   \c!alternative=\c!a,
>   \c!distance=.25ex,
>   \c!color=]
>
> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-23 13:32   ` Hans van der Meer
@ 2010-01-23 13:49     ` Wolfgang Schuster
  2010-01-23 15:06       ` Hans van der Meer
  2010-01-24 13:02     ` Hans Hagen
  2010-01-24 13:04     ` Hans Hagen
  2 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2010-01-23 13:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 23.01.10 14:32, schrieb Hans van der Meer:
> Further experimentation has shown that it is not impossible to color
> \vrule's, thus \blackrule is not specifically needed.

\blackrule is a \vrule which is enclosed in \startcolor/\stopcolor.

> Let me first mention that I put the colored rules away with
> \setbox\B=\hbox{} and then later call \B up.

Why so complicated?

It is a pity until now I am not able to concoct a
> minimal example showing consistently the behaviour.
>
> However I have made the following observations:
> define: \definecolor[mycolor][r=myR,g=myG,b=myB]

Have you tried '{\mycolor\vrule <spec>\relax}'?

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-23 13:49     ` Wolfgang Schuster
@ 2010-01-23 15:06       ` Hans van der Meer
  2010-01-23 18:19         ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Hans van der Meer @ 2010-01-23 15:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On 23 jan 2010, at 14:49, Wolfgang Schuster wrote:

> Am 23.01.10 14:32, schrieb Hans van der Meer:
>> Further experimentation has shown that it is not impossible to color
>> \vrule's, thus \blackrule is not specifically needed.
>
> \blackrule is a \vrule which is enclosed in \startcolor/\stopcolor.
>
>> Let me first mention that I put the colored rules away with
>> \setbox\B=\hbox{} and then later call \B up.
>
> Why so complicated?
>
> It is a pity until now I am not able to concoct a
>> minimal example showing consistently the behaviour.
>>
>> However I have made the following observations:
>> define: \definecolor[mycolor][r=myR,g=myG,b=myB]
>
> Have you tried '{\mycolor\vrule <spec>\relax}'?

No, I hadn't, but now I have. And it worked. The simplest solution is  
most of the times the best, indeed. Thanks.

>
> Wolfgang
> ___________________________________________________________________________________

Hans van der Meer
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-23 15:06       ` Hans van der Meer
@ 2010-01-23 18:19         ` Wolfgang Schuster
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Schuster @ 2010-01-23 18:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 23.01.10 16:06, schrieb Hans van der Meer:
>> Have you tried '{\mycolor\vrule <spec>\relax}'?
>
> No, I hadn't, but now I have. And it worked. The simplest solution is
> most of the times the best, indeed. Thanks.

Can you also check if it works when you add a \relax at the end
of the \vrule command in the other cases, e.g.

\color[mycolor]{\vrule <spec>\relax}

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-23 13:32   ` Hans van der Meer
  2010-01-23 13:49     ` Wolfgang Schuster
@ 2010-01-24 13:02     ` Hans Hagen
  2010-01-24 13:04     ` Hans Hagen
  2 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2010-01-24 13:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 23-1-2010 14:32, Hans van der Meer wrote:
> Further experimentation has shown that it is not impossible to color
> \vrule's, thus \blackrule is not specifically needed. Let me first
> mention that I put the colored rules away with \setbox\B=\hbox{} and
> then later call \B up. It is a pity until now I am not able to concoct a
> minimal example showing consistently the behaviour.
>
> However I have made the following observations:
> define: \definecolor[mycolor][r=myR,g=myG,b=myB]
>
> (1) \color[mycolor]{rule} typesets a black rule
> (2) \color[red]{something}\color[mycolor]{rule} typesets a mycolor rule
> (3) \definecolor[green][r=myR,g=myG,b=myB]\color[mycolor]{rule} typesets
> a mycolor rule
> (4) changing the values of myR,myG,myB between runs keeps typesetting
> the old mycolor
> (5) it seems there is a memory effect on defined colors, something with
> a cache that keeps me from changing things.
>
> It is mainly the seemingly erratic behaviour of the color changes that
> puzzles me. I seem not being able to pinpoint a culprit.

it's not that erratic at all, just do the same experiment with fonts ...

In traditional tex color is implemented using specials and code is 
injected. Compare this with fonts: you choose a font, which sets a state 
and that state carries with the following glyphs till set otherwise (or 
restored). Boxing and unboxing keeps that state.

In mkiv we use attributes for color (btw, the mk.pdf documents mentions 
al those things). And attributes are kept with objects and as a result 
are retained, which in my opinion is as it shoul dbe.

So, in traditional tex you have:

box == somerule

[somecolor][thatbox]

which effectively is

[somecolor]somerule

so the rule gets somecolor

but if you have

box == [somecolor]somerule

[anothercolor][thatbox]

you have

[anothercolor][somecolor]somerule

and te box will stay somecolor

in mkiv nocolor is really nocolor so in the first example your rule will 
be black (as it has no attribute set and will not gte one set either as 
a box has frozen states

When I wrote the backend code for colors I added an inheritance model 
but it's not yet perfect (and might even disappear or change).

\starttext

x\definecolor[mycolor][green]\color[mycolor]{\vrule width 10cm}x

\setbox0\hbox{x\color[mycolor]{\vrule width 10cm}x}

x\definecolor[mycolor][red]\color[mycolor]{\vrule width 10cm}x

\color[mycolor]{\copy0}

\enableattributeinheritance

\color[mycolor]{\attributedcopy0}

\stoptext

Your bad luck is that inheritance does not play well with rules currently.

On the other hand, the fact that you could this in mkii is no proof that 
it's the right way to do it. Most attribute driven features behave like 
fonts have been doing in mkii for ages.

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: coloring rules
  2010-01-23 13:32   ` Hans van der Meer
  2010-01-23 13:49     ` Wolfgang Schuster
  2010-01-24 13:02     ` Hans Hagen
@ 2010-01-24 13:04     ` Hans Hagen
  2 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2010-01-24 13:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 23-1-2010 14:32, Hans van der Meer wrote:

> mention that I put the colored rules away with \setbox\B=\hbox{} and

btw, this line in your mail is pretty important as that explains the 
behaviour

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-24 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-21 16:28 coloring rules Hans van der Meer
2010-01-21 21:24 ` Aditya Mahajan
2010-01-23 13:32   ` Hans van der Meer
2010-01-23 13:49     ` Wolfgang Schuster
2010-01-23 15:06       ` Hans van der Meer
2010-01-23 18:19         ` Wolfgang Schuster
2010-01-24 13:02     ` Hans Hagen
2010-01-24 13:04     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).