* Color specific cells in a table
@ 2020-08-23 14:35 Fabrice Couvreur
0 siblings, 0 replies; only message in thread
From: Fabrice Couvreur @ 2020-08-23 14:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1697 bytes --]
Hello,
This table will be used to illustrate Pascal's triangle. I manage to color
the cell (2,0) but I would also like to color the cells (2,1) and (3,1). Is
it possible ?
Thank you
Fabrice
\usecolors[X11]
\starttext
\startluacode
local background_one = {
align = "middle",
style = "type",
background = "color",
backgroundcolor = "thistle2",
foregroundcolor = "white",
}
local background_two = {
align = "middle",
style = "type",
background = "color",
backgroundcolor = "peachpuff",
foregroundcolor = "white",
}
context.startxtable({"align={middle,lohi},
width=1cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
context.startxrow()
context.startxcell({"background=color,backgroundcolor=thistle2"})
context("")
context.stopxcell()
for j = 0, 7 do
context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
context(j)
context.stopxcell()
end
context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
context("\\dots")
context.stopxcell()
context.stopxrow()
for i = 0, 7 do
context.startxrow()
context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"})
context(i)
context.stopxcell()
for j = 0, 8 do
context.startxcell(j>i and background_one or i == 2 and j == 0 and
background_two)
context("")
context.stopxcell()
end
context.stopxrow()
end
context.startxrow()
context.startxcell({"background=color,backgroundcolor=thistle2"})
context("\\dots")
context.stopxcell()
for i = 0, 8 do
context.startxcell()
context("")
context.stopxcell()
end
context.stopxrow()
context.stopxtable()
\stopluacode
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 2810 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-23 14:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 14:35 Color specific cells in a table Fabrice Couvreur
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).