Define bclogo environment that changes color with each section












1















For my theorems and section titles, I use i.e.



usepackage{listofitem}
setsepchar{,}
readlistmycolors{amaranth,blue,orange,purple}

definecolor{amaranth}{HTML}{a82337}
definecolor{orange}{HTML}{BF7F00}
definecolor{blue}{HTML}{016FB9}
definecolor{purple}{HTML}{603C96}

usepackage[explicit]{titlesec}
titleformat{subsection}{
normalfontLargebfseries}{}{0pt}{colorbox{mycolors[thesection]!10{thesubsection #1}}


to make my headings change color with each section (from this answer.



Now, I use the same specifications for my bclogo environments:



usepackage[tikz]{bclogo}
begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre=blue!10,noborder=true,ombre=true]{Idee}
Some text.
end{bclogo}


Now, I want to define a new environment, which looks like this and changes its colors with each section like my section titles, so I don't have to write all the options every time I use this environment.



MWE:



documentclass[a4paper,twoside,ngerman]{article}
usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
usepackage{enumitem} % einfacher Nummerierung verändern
usepackage{tikz} % zeichnen
usetikzlibrary{cd} % kommutierende Diagramme
usepackage{listofitems} % für Farben für Kapitel
usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

usepackage{babel} % neue Rechtschreibung, Worttrennung
usepackage[utf8]{inputenc} % Inputencoding
usepackage[T1]{fontenc} % Umlaute
usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

%theorems
usepackage{tcolorbox}
tcbuselibrary{theorems}
newtcbtheorem[number within=subsection]{thm}{Satz}
{{colback=mycolors[thesection]!5},
{colframe=mycolors[thesection]!95!black},
fonttitle=scshapebfseries,
before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

setsepchar{,}
readlistmycolors{amaranth,blue,orange,purple}

definecolor{amaranth}{HTML}{a82337}
definecolor{orange}{HTML}{BF7F00}
definecolor{blue}{HTML}{016FB9}
definecolor{purple}{HTML}{603C96}

% formatting
usepackage[explicit]{titlesec}

titleformat{section}
{normalfontLARGEbfseriesraggedright}
{llap{colorbox{mycolors[thesection]}{makebox[3em][r] {textcolor{white}{thesection}}}hspace{1em}}}
{0pt}
{#1}

begin{document}
section{first, red section}

begin{bclogo}[logo = bclampe, couleur=amaranth!10,arrondi=0.1, couleurBarre= amaranth!10,noborder=true,ombre=true]{Idee}
Some text.
end{bclogo}

section{next, blue section}
begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre= blue!10,noborder=true,ombre=true]{Idee}
Some text.
end{bclogo}
end{document}









share|improve this question



























    1















    For my theorems and section titles, I use i.e.



    usepackage{listofitem}
    setsepchar{,}
    readlistmycolors{amaranth,blue,orange,purple}

    definecolor{amaranth}{HTML}{a82337}
    definecolor{orange}{HTML}{BF7F00}
    definecolor{blue}{HTML}{016FB9}
    definecolor{purple}{HTML}{603C96}

    usepackage[explicit]{titlesec}
    titleformat{subsection}{
    normalfontLargebfseries}{}{0pt}{colorbox{mycolors[thesection]!10{thesubsection #1}}


    to make my headings change color with each section (from this answer.



    Now, I use the same specifications for my bclogo environments:



    usepackage[tikz]{bclogo}
    begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre=blue!10,noborder=true,ombre=true]{Idee}
    Some text.
    end{bclogo}


    Now, I want to define a new environment, which looks like this and changes its colors with each section like my section titles, so I don't have to write all the options every time I use this environment.



    MWE:



    documentclass[a4paper,twoside,ngerman]{article}
    usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
    usepackage{enumitem} % einfacher Nummerierung verändern
    usepackage{tikz} % zeichnen
    usetikzlibrary{cd} % kommutierende Diagramme
    usepackage{listofitems} % für Farben für Kapitel
    usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

    usepackage{babel} % neue Rechtschreibung, Worttrennung
    usepackage[utf8]{inputenc} % Inputencoding
    usepackage[T1]{fontenc} % Umlaute
    usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

    usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

    %theorems
    usepackage{tcolorbox}
    tcbuselibrary{theorems}
    newtcbtheorem[number within=subsection]{thm}{Satz}
    {{colback=mycolors[thesection]!5},
    {colframe=mycolors[thesection]!95!black},
    fonttitle=scshapebfseries,
    before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

    setsepchar{,}
    readlistmycolors{amaranth,blue,orange,purple}

    definecolor{amaranth}{HTML}{a82337}
    definecolor{orange}{HTML}{BF7F00}
    definecolor{blue}{HTML}{016FB9}
    definecolor{purple}{HTML}{603C96}

    % formatting
    usepackage[explicit]{titlesec}

    titleformat{section}
    {normalfontLARGEbfseriesraggedright}
    {llap{colorbox{mycolors[thesection]}{makebox[3em][r] {textcolor{white}{thesection}}}hspace{1em}}}
    {0pt}
    {#1}

    begin{document}
    section{first, red section}

    begin{bclogo}[logo = bclampe, couleur=amaranth!10,arrondi=0.1, couleurBarre= amaranth!10,noborder=true,ombre=true]{Idee}
    Some text.
    end{bclogo}

    section{next, blue section}
    begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre= blue!10,noborder=true,ombre=true]{Idee}
    Some text.
    end{bclogo}
    end{document}









    share|improve this question

























      1












      1








      1








      For my theorems and section titles, I use i.e.



      usepackage{listofitem}
      setsepchar{,}
      readlistmycolors{amaranth,blue,orange,purple}

      definecolor{amaranth}{HTML}{a82337}
      definecolor{orange}{HTML}{BF7F00}
      definecolor{blue}{HTML}{016FB9}
      definecolor{purple}{HTML}{603C96}

      usepackage[explicit]{titlesec}
      titleformat{subsection}{
      normalfontLargebfseries}{}{0pt}{colorbox{mycolors[thesection]!10{thesubsection #1}}


      to make my headings change color with each section (from this answer.



      Now, I use the same specifications for my bclogo environments:



      usepackage[tikz]{bclogo}
      begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre=blue!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}


      Now, I want to define a new environment, which looks like this and changes its colors with each section like my section titles, so I don't have to write all the options every time I use this environment.



      MWE:



      documentclass[a4paper,twoside,ngerman]{article}
      usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
      usepackage{enumitem} % einfacher Nummerierung verändern
      usepackage{tikz} % zeichnen
      usetikzlibrary{cd} % kommutierende Diagramme
      usepackage{listofitems} % für Farben für Kapitel
      usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

      usepackage{babel} % neue Rechtschreibung, Worttrennung
      usepackage[utf8]{inputenc} % Inputencoding
      usepackage[T1]{fontenc} % Umlaute
      usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

      usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

      %theorems
      usepackage{tcolorbox}
      tcbuselibrary{theorems}
      newtcbtheorem[number within=subsection]{thm}{Satz}
      {{colback=mycolors[thesection]!5},
      {colframe=mycolors[thesection]!95!black},
      fonttitle=scshapebfseries,
      before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

      setsepchar{,}
      readlistmycolors{amaranth,blue,orange,purple}

      definecolor{amaranth}{HTML}{a82337}
      definecolor{orange}{HTML}{BF7F00}
      definecolor{blue}{HTML}{016FB9}
      definecolor{purple}{HTML}{603C96}

      % formatting
      usepackage[explicit]{titlesec}

      titleformat{section}
      {normalfontLARGEbfseriesraggedright}
      {llap{colorbox{mycolors[thesection]}{makebox[3em][r] {textcolor{white}{thesection}}}hspace{1em}}}
      {0pt}
      {#1}

      begin{document}
      section{first, red section}

      begin{bclogo}[logo = bclampe, couleur=amaranth!10,arrondi=0.1, couleurBarre= amaranth!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}

      section{next, blue section}
      begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre= blue!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}
      end{document}









      share|improve this question














      For my theorems and section titles, I use i.e.



      usepackage{listofitem}
      setsepchar{,}
      readlistmycolors{amaranth,blue,orange,purple}

      definecolor{amaranth}{HTML}{a82337}
      definecolor{orange}{HTML}{BF7F00}
      definecolor{blue}{HTML}{016FB9}
      definecolor{purple}{HTML}{603C96}

      usepackage[explicit]{titlesec}
      titleformat{subsection}{
      normalfontLargebfseries}{}{0pt}{colorbox{mycolors[thesection]!10{thesubsection #1}}


      to make my headings change color with each section (from this answer.



      Now, I use the same specifications for my bclogo environments:



      usepackage[tikz]{bclogo}
      begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre=blue!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}


      Now, I want to define a new environment, which looks like this and changes its colors with each section like my section titles, so I don't have to write all the options every time I use this environment.



      MWE:



      documentclass[a4paper,twoside,ngerman]{article}
      usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
      usepackage{enumitem} % einfacher Nummerierung verändern
      usepackage{tikz} % zeichnen
      usetikzlibrary{cd} % kommutierende Diagramme
      usepackage{listofitems} % für Farben für Kapitel
      usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

      usepackage{babel} % neue Rechtschreibung, Worttrennung
      usepackage[utf8]{inputenc} % Inputencoding
      usepackage[T1]{fontenc} % Umlaute
      usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

      usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

      %theorems
      usepackage{tcolorbox}
      tcbuselibrary{theorems}
      newtcbtheorem[number within=subsection]{thm}{Satz}
      {{colback=mycolors[thesection]!5},
      {colframe=mycolors[thesection]!95!black},
      fonttitle=scshapebfseries,
      before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

      setsepchar{,}
      readlistmycolors{amaranth,blue,orange,purple}

      definecolor{amaranth}{HTML}{a82337}
      definecolor{orange}{HTML}{BF7F00}
      definecolor{blue}{HTML}{016FB9}
      definecolor{purple}{HTML}{603C96}

      % formatting
      usepackage[explicit]{titlesec}

      titleformat{section}
      {normalfontLARGEbfseriesraggedright}
      {llap{colorbox{mycolors[thesection]}{makebox[3em][r] {textcolor{white}{thesection}}}hspace{1em}}}
      {0pt}
      {#1}

      begin{document}
      section{first, red section}

      begin{bclogo}[logo = bclampe, couleur=amaranth!10,arrondi=0.1, couleurBarre= amaranth!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}

      section{next, blue section}
      begin{bclogo}[logo = bclampe, couleur=blue!10,arrondi=0.1, couleurBarre= blue!10,noborder=true,ombre=true]{Idee}
      Some text.
      end{bclogo}
      end{document}






      color bclogo






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 4 at 9:49









      Viktor GlombikViktor Glombik

      1429




      1429






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Instead of using a list of colour names, I would simply include the section number in the colour name. Then you can use it like couleur=mycolthesection!10 to mix the colours of the bclogo boxes



          documentclass[a4paper,twoside,ngerman]{article}
          usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
          usepackage{enumitem} % einfacher Nummerierung verändern
          usepackage{tikz} % zeichnen
          usetikzlibrary{cd} % kommutierende Diagramme
          usepackage{listofitems} % für Farben für Kapitel
          usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

          usepackage{babel} % neue Rechtschreibung, Worttrennung
          usepackage[utf8]{inputenc} % Inputencoding
          usepackage[T1]{fontenc} % Umlaute

          usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

          %theorems
          usepackage{tcolorbox}
          tcbuselibrary{theorems}
          newtcbtheorem[number within=subsection]{thm}{Satz}
          {{colback=mycolnumbervalue{section}!5},
          {colframe=mycolnumbervalue{section}!95!black},
          fonttitle=scshapebfseries,
          before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

          definecolor{mycol1}{HTML}{a82337}
          definecolor{mycol2}{HTML}{016FB9}
          definecolor{mycol3}{HTML}{BF7F00}
          definecolor{mycol4}{HTML}{603C96}

          % formatting
          usepackage[explicit]{titlesec}

          titleformat{section}
          {normalfontLARGEbfseriesraggedright}
          {llap{colorbox{mycolnumbervalue{section}}{makebox[3em][r] {textcolor{white}{numbervalue{section}}}}hspace{1em}}}
          {0pt}
          {#1}

          usepackage{etoolbox}

          newenvironment{mybclogo}[1]{%
          begin{bclogo}[logo = bclampe, couleur=mycolnumbervalue{section}!10,arrondi=0.1, couleurBarre= mycolnumbervalue{section}!10,noborder=true,ombre=true]{#1}
          }{
          end{bclogo}
          }

          usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

          begin{document}
          section{first, red section}

          begin{mybclogo}{Idee}
          Some text.
          end{mybclogo}

          section{next, blue section}
          begin{mybclogo}{Idee}
          Some text.
          end{mybclogo}
          end{document}


          enter image description here






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473298%2fdefine-bclogo-environment-that-changes-color-with-each-section%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Instead of using a list of colour names, I would simply include the section number in the colour name. Then you can use it like couleur=mycolthesection!10 to mix the colours of the bclogo boxes



            documentclass[a4paper,twoside,ngerman]{article}
            usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
            usepackage{enumitem} % einfacher Nummerierung verändern
            usepackage{tikz} % zeichnen
            usetikzlibrary{cd} % kommutierende Diagramme
            usepackage{listofitems} % für Farben für Kapitel
            usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

            usepackage{babel} % neue Rechtschreibung, Worttrennung
            usepackage[utf8]{inputenc} % Inputencoding
            usepackage[T1]{fontenc} % Umlaute

            usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

            %theorems
            usepackage{tcolorbox}
            tcbuselibrary{theorems}
            newtcbtheorem[number within=subsection]{thm}{Satz}
            {{colback=mycolnumbervalue{section}!5},
            {colframe=mycolnumbervalue{section}!95!black},
            fonttitle=scshapebfseries,
            before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

            definecolor{mycol1}{HTML}{a82337}
            definecolor{mycol2}{HTML}{016FB9}
            definecolor{mycol3}{HTML}{BF7F00}
            definecolor{mycol4}{HTML}{603C96}

            % formatting
            usepackage[explicit]{titlesec}

            titleformat{section}
            {normalfontLARGEbfseriesraggedright}
            {llap{colorbox{mycolnumbervalue{section}}{makebox[3em][r] {textcolor{white}{numbervalue{section}}}}hspace{1em}}}
            {0pt}
            {#1}

            usepackage{etoolbox}

            newenvironment{mybclogo}[1]{%
            begin{bclogo}[logo = bclampe, couleur=mycolnumbervalue{section}!10,arrondi=0.1, couleurBarre= mycolnumbervalue{section}!10,noborder=true,ombre=true]{#1}
            }{
            end{bclogo}
            }

            usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

            begin{document}
            section{first, red section}

            begin{mybclogo}{Idee}
            Some text.
            end{mybclogo}

            section{next, blue section}
            begin{mybclogo}{Idee}
            Some text.
            end{mybclogo}
            end{document}


            enter image description here






            share|improve this answer






























              2














              Instead of using a list of colour names, I would simply include the section number in the colour name. Then you can use it like couleur=mycolthesection!10 to mix the colours of the bclogo boxes



              documentclass[a4paper,twoside,ngerman]{article}
              usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
              usepackage{enumitem} % einfacher Nummerierung verändern
              usepackage{tikz} % zeichnen
              usetikzlibrary{cd} % kommutierende Diagramme
              usepackage{listofitems} % für Farben für Kapitel
              usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

              usepackage{babel} % neue Rechtschreibung, Worttrennung
              usepackage[utf8]{inputenc} % Inputencoding
              usepackage[T1]{fontenc} % Umlaute

              usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

              %theorems
              usepackage{tcolorbox}
              tcbuselibrary{theorems}
              newtcbtheorem[number within=subsection]{thm}{Satz}
              {{colback=mycolnumbervalue{section}!5},
              {colframe=mycolnumbervalue{section}!95!black},
              fonttitle=scshapebfseries,
              before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

              definecolor{mycol1}{HTML}{a82337}
              definecolor{mycol2}{HTML}{016FB9}
              definecolor{mycol3}{HTML}{BF7F00}
              definecolor{mycol4}{HTML}{603C96}

              % formatting
              usepackage[explicit]{titlesec}

              titleformat{section}
              {normalfontLARGEbfseriesraggedright}
              {llap{colorbox{mycolnumbervalue{section}}{makebox[3em][r] {textcolor{white}{numbervalue{section}}}}hspace{1em}}}
              {0pt}
              {#1}

              usepackage{etoolbox}

              newenvironment{mybclogo}[1]{%
              begin{bclogo}[logo = bclampe, couleur=mycolnumbervalue{section}!10,arrondi=0.1, couleurBarre= mycolnumbervalue{section}!10,noborder=true,ombre=true]{#1}
              }{
              end{bclogo}
              }

              usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

              begin{document}
              section{first, red section}

              begin{mybclogo}{Idee}
              Some text.
              end{mybclogo}

              section{next, blue section}
              begin{mybclogo}{Idee}
              Some text.
              end{mybclogo}
              end{document}


              enter image description here






              share|improve this answer




























                2












                2








                2







                Instead of using a list of colour names, I would simply include the section number in the colour name. Then you can use it like couleur=mycolthesection!10 to mix the colours of the bclogo boxes



                documentclass[a4paper,twoside,ngerman]{article}
                usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
                usepackage{enumitem} % einfacher Nummerierung verändern
                usepackage{tikz} % zeichnen
                usetikzlibrary{cd} % kommutierende Diagramme
                usepackage{listofitems} % für Farben für Kapitel
                usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

                usepackage{babel} % neue Rechtschreibung, Worttrennung
                usepackage[utf8]{inputenc} % Inputencoding
                usepackage[T1]{fontenc} % Umlaute

                usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

                %theorems
                usepackage{tcolorbox}
                tcbuselibrary{theorems}
                newtcbtheorem[number within=subsection]{thm}{Satz}
                {{colback=mycolnumbervalue{section}!5},
                {colframe=mycolnumbervalue{section}!95!black},
                fonttitle=scshapebfseries,
                before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

                definecolor{mycol1}{HTML}{a82337}
                definecolor{mycol2}{HTML}{016FB9}
                definecolor{mycol3}{HTML}{BF7F00}
                definecolor{mycol4}{HTML}{603C96}

                % formatting
                usepackage[explicit]{titlesec}

                titleformat{section}
                {normalfontLARGEbfseriesraggedright}
                {llap{colorbox{mycolnumbervalue{section}}{makebox[3em][r] {textcolor{white}{numbervalue{section}}}}hspace{1em}}}
                {0pt}
                {#1}

                usepackage{etoolbox}

                newenvironment{mybclogo}[1]{%
                begin{bclogo}[logo = bclampe, couleur=mycolnumbervalue{section}!10,arrondi=0.1, couleurBarre= mycolnumbervalue{section}!10,noborder=true,ombre=true]{#1}
                }{
                end{bclogo}
                }

                usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

                begin{document}
                section{first, red section}

                begin{mybclogo}{Idee}
                Some text.
                end{mybclogo}

                section{next, blue section}
                begin{mybclogo}{Idee}
                Some text.
                end{mybclogo}
                end{document}


                enter image description here






                share|improve this answer















                Instead of using a list of colour names, I would simply include the section number in the colour name. Then you can use it like couleur=mycolthesection!10 to mix the colours of the bclogo boxes



                documentclass[a4paper,twoside,ngerman]{article}
                usepackage{amsmath,amsfonts,cancel,mathtools,framed,mathabx,array,amssymb}
                usepackage{enumitem} % einfacher Nummerierung verändern
                usepackage{tikz} % zeichnen
                usetikzlibrary{cd} % kommutierende Diagramme
                usepackage{listofitems} % für Farben für Kapitel
                usepackage[tikz]{bclogo} % Kästen für Errinerung etc.

                usepackage{babel} % neue Rechtschreibung, Worttrennung
                usepackage[utf8]{inputenc} % Inputencoding
                usepackage[T1]{fontenc} % Umlaute

                usepackage[thmmarks,framed,thref,hyperref]{ntheorem} % [thmmarks] guarantees endmarks

                %theorems
                usepackage{tcolorbox}
                tcbuselibrary{theorems}
                newtcbtheorem[number within=subsection]{thm}{Satz}
                {{colback=mycolnumbervalue{section}!5},
                {colframe=mycolnumbervalue{section}!95!black},
                fonttitle=scshapebfseries,
                before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

                definecolor{mycol1}{HTML}{a82337}
                definecolor{mycol2}{HTML}{016FB9}
                definecolor{mycol3}{HTML}{BF7F00}
                definecolor{mycol4}{HTML}{603C96}

                % formatting
                usepackage[explicit]{titlesec}

                titleformat{section}
                {normalfontLARGEbfseriesraggedright}
                {llap{colorbox{mycolnumbervalue{section}}{makebox[3em][r] {textcolor{white}{numbervalue{section}}}}hspace{1em}}}
                {0pt}
                {#1}

                usepackage{etoolbox}

                newenvironment{mybclogo}[1]{%
                begin{bclogo}[logo = bclampe, couleur=mycolnumbervalue{section}!10,arrondi=0.1, couleurBarre= mycolnumbervalue{section}!10,noborder=true,ombre=true]{#1}
                }{
                end{bclogo}
                }

                usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}

                begin{document}
                section{first, red section}

                begin{mybclogo}{Idee}
                Some text.
                end{mybclogo}

                section{next, blue section}
                begin{mybclogo}{Idee}
                Some text.
                end{mybclogo}
                end{document}


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Feb 4 at 10:28

























                answered Feb 4 at 10:11









                samcartersamcarter

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473298%2fdefine-bclogo-environment-that-changes-color-with-each-section%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents