1

Can one change the colour of the line surounding block, framecolor, for individual blocks when using tikzposter?

If so, how? I fail to find it out.

The background colour of a block, blockbodybgcolor is simple to change individually, so it feels strange that framecolor should be different.

Thank you in advance!

2
  • It's blocktitlebgcolor I think, as in tex.stackexchange.com/questions/343115/… Jul 26 '18 at 8:21
  • @Torbjørn T. is correct. You will still probably want to add the linewidth key to the block specification because the default frame width is very narrow (e.g. add linewidth=10pt).
    – Ross
    Jul 26 '18 at 8:40
2

It depends on the blockstyle used, see the file tikzposterBlockstyles.tex. In some of the styles you'll find color=framecolor, in others color=blocktitlebgcolor. In Envelope it's blocktitlebgcolor, so you need

\colorlet{blocktitlebgcolor}{<colour spec>}
1

I think what's happening is that the default line width of the frame is too narrow to see the color change.

Define a blockstyle with \blockstyle{blockstylename}. I used \blockstyle{myblockstyle}. To this blockstyle, add to the \draw commands line width = x pt where x pt is the desired line width of the block frame. I added line width=10pt. Set the style of the blocks that follow with \useblockstyle{myblockstyle}. Then, declare the desired framecolor, say magenta, with \colorlet{framecolor}{magenta} immediately before giving the block specifications with \block.

I borrowed the code from @Torbjørn T.'s answer to your last question, Different block heights in tikzposter, to make an MWE. It gives this result, creating one block with a magenta frame and another with a cyan frame.

enter image description here

This is the code:

%From https://tex.stackexchange.com/a/443206/
\documentclass[
  usenames,
  dvipsnames,
  a2paper,
  subcolspace = 3 mm,
  colspace = 3 mm,
  landscape,
  innermargin = 3 mm,
  margin = 7 mm,
%  blockhorizontalspace = 5 mm, % this is not a valid option, doesn't do anything
  blockverticalspace = 5 mm,
  25 pt]{tikzposter}


\usetheme{Envelope} % See Section 5 (Rätt okej!)
\usecolorstyle[colorPalette=BrownBlueOrange]{Germany}

\tikzposterlatexaffectionproofoff

\begin{document}

\makeatletter
    \setlength{\TP@blocktop}{.495\textheight}
\makeatother

\settitle{ }
\colorlet{blockbodybgcolor}{MidnightBlue!100}
\colorlet{blockbodyfgcolor}{white} % color of text, no need for \color{white} everywhere


\defineblockstyle{myblockstyle}{
titlewidthscale=0.9, bodywidthscale=1,titleleft,
titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0mm, bodyoffsety=15mm,
bodyverticalshift=10mm, roundedcorners=5,
titleinnersep=6mm, bodyinnersep=1cm
}{
\draw[color=framecolor, fill=blockbodybgcolor, line width=10pt,  %<- added line width=10pt
rounded corners=\blockroundedcorners] (blockbody.south west)
rectangle (blockbody.north east);
\ifBlockHasTitle
\draw[color=framecolor, fill=blocktitlebgcolor, line width=10pt,  %<- added line width=10pt
rounded corners=\blockroundedcorners] (blocktitle.south west)
rectangle (blocktitle.north east);
\fi
}

\useblockstyle{myblockstyle}
\begin{columns}
    \column{0.5}
    \colorlet{framecolor}{magenta}                                %<- declare the frame color
    \block[bodyoffsetx = 0 mm,
           bodyoffsety=-2cm,
           bodyverticalshift = 0 mm,
           bodyinnersep = 3 mm,
           linewidth=10pt,        %<- need this for spacing between test2a and test2b blocks 
           titleinnersep = 0em,
           roundedcorners=0]{}{\raggedright\fontsize{60pt}{60pt}\selectfont Test1a}

    \column{0.5}
    \colorlet{framecolor}{cyan}                                    %<- declare the frame color
    \block[bodyoffsetx = 0 mm,
           bodyoffsety=-2cm,
           bodyverticalshift = 0 mm,
           bodyinnersep = 3 mm,
           titleinnersep = 0em,
           roundedcorners=0]{}{\raggedright \fontsize{60pt}{60pt}\selectfont Test1b}
\end{columns}

\end{document} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.