Hi Henry,
Thank you for your proposition. I tested both : the first work  but not the second.
Fabrice

lua error       > lua error on line 13 in file /home/viserion/Ntg_7.tex:

...ext/tex/texmf-context/tex/context/base/mkiv/tabl-xtb.lua:1269: attempt to index a nil value (upvalue 'data')

 3    
 4     \startuseMPgraphic{tablebackground}{i,j}
 5     if (\MPvar{i} = 1) or (\MPvar{j} = 1):
 6           fill OverlayBox withcolor \MPcolor{fondpaille} ;
 7     fi;
 8     \stopuseMPgraphic
 9    
10     \defineoverlay
11       [tablebackground]
12    
13 >>  [\useMPgraphic{tablebackground}{i=\currentxtablerow,j=\currentxtablecolumn}]
14    
15     \setupxtable[background=tablebackground]
16    
17     \starttext
18     \startluacode
19     local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
20     local letters_2 = { "A", "0", "1", "1", "0", "", "", "", "", "" }
21     context.startxtable({"align={middle,lohi}, width=1.25cm,offset=0.8ex"})
22    
23     context.startxrow()


?

Le dim. 27 janv. 2019 à 00:34, Henri Menke <henrimenke@gmail.com> a écrit :
On 1/27/19 12:26 PM, Henri Menke wrote:
> On 1/27/19 12:08 PM, Fabrice Couvreur wrote:
>> Hi,
>> How to color the first column as I did for the first line ?
>
> Stolen from Wolfgang's answer on TeX.SX.
> https://tex.stackexchange.com/a/464771
>

You could also evaluate the conditional purely in MetaPost.  I don't
know if that would be faster, but it's a bit more readable to me.


\startuseMPgraphic{tablebackground}{i,j}
if (\MPvar{i} = 1) or (\MPvar{j} = 1):
      fill OverlayBox withcolor \MPcolor{fondpaille} ;
fi;
\stopuseMPgraphic

\defineoverlay
  [tablebackground]

[\useMPgraphic{tablebackground}{i=\currentxtablerow,j=\currentxtablecolumn}]

\setupxtable[background=tablebackground]

>
> \definecolor[fondpaille][c=0,m=0,y=0.2,k=0]
>
> \startuseMPgraphic {tablebackground}
>   fill OverlayBox withcolor \MPcolor{fondpaille} ;
> \stopuseMPgraphic
>
> \defineoverlay
>   [tablebackground]
>   [\ifnum\currentxtablerow=1
>        \useMPgraphic{tablebackground}%
>    \else\ifnum\currentxtablecolumn=1
>        \useMPgraphic{tablebackground}%
>    \fi\fi]
>
> \setupxtable[background=tablebackground]
>
> \starttext
> \startluacode
> local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
> local letters_2 = { "A", "0", "1", "1", "0", "", "", "", "", "" }
> context.startxtable({"align={middle,lohi}, width=1.25cm,offset=0.8ex"})
>
> context.startxrow()
> context.startxcell({"background=color,backgroundcolor=white,frame=off"})
> context("")
> context.stopxcell()
> for _, letter in ipairs(letters_1) do
>     context.startxcell()
>     context(letter) context.stopxcell()
> end
> context.stopxrow()
>
> context.startxrow()
> for _, letter in ipairs(letters_2) do
>     context.startxcell() context(letter) context.stopxcell()
> end
> context.stopxrow()
>
> for i=2,10 do
>     context.startxrow()
>     context.startxcell()  context(converters.convert("A",i))
>     context.stopxcell()
>     context.stopxrow()
> end
>
> context.stopxtable()
> \stopluacode
> \stoptext
>
>
>> Thank you
>> Fabrice
>>
>> \definecolor[fondpaille][c=0,m=0,y=0.2,k=0]
>> \starttext
>> \startluacode
>> local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
>> local letters_2 = { "A", "0", "1", "1", "0", "", "", "", "", "" }
>> context.startxtable({"align={middle,lohi}, width=1.25cm,offset=0.8ex"})
>> context.startxrow()
>> context.startxcell({"background=color,backgroundcolor=white,frame=off"})
>> context("") context.stopxcell()
>> for _, letter in ipairs(letters_1) do
>>      context.startxcell({"background=color,backgroundcolor=fondpaille"})
>> context(letter) context.stopxcell()
>> end
>> context.stopxrow()
>> context.startxrow()
>> for _, letter in ipairs(letters_2) do
>>      context.startxcell() context(letter) context.stopxcell()
>> end
>> context.stopxrow()
>> for i=2,10 do
>>      context.startxrow()
>>      context.startxcell()  context(converters.convert("A",i))
>> context.stopxcell()
>>      context.stopxrow()
>> end
>> context.stopxtable()
>> \stopluacode
>> \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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________
>>
>

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