Cover page coloring in ConTeXt












3















How would I go about coloring the top and bottom of a page in ConTeXt/Metafun?



Currently I am using this code



definecolor [Top] [h=00ff00]
definecolor [Bottom] [h=ff0000]
definecolor [TitleColor] [h=0000ff]
setupmakeup [CoverPage] [pagestart=yes]
definehighlight [CoverTitle] [color=TitleColor]

startuseMPgraphic{Head}
StartPage ;
fill Page withcolor MPcolor{Top} ;
StopPage ;
stopuseMPgraphic

defineoverlay[page][useMPgraphic{Head}]
setupbackgrounds[page][background=page]

starttext
startmakeup[CoverPage][doublesided=no]
definedfont[Serif at 20.7pt]setstrut strut Author par
definedfont[Serif at 32.7pt]setstrut strut TitleColor{Cover Page Title} par
% I would like to separate the top and bottom colors here.
definedfont[Serif at 24.9pt]setstrut strut TitleColor{Subhead Title}
stopmakeup
stoptext


Which obviously returns a page with a single color.



I am learning ConTeXt/Metafun, so the above code is "cargo cult"-ish. If there is a better way I would like to know.










share|improve this question




















  • 1





    Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

    – sztruks
    Jan 30 at 20:21











  • Yes, I approximated the code. Sorry about that.

    – StillSubjectToChange
    Jan 30 at 20:22











  • I made an edit to your code. Compiles now.

    – sztruks
    Jan 30 at 20:24








  • 1





    You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

    – Henri Menke
    Jan 30 at 21:24











  • @HenriMenke Noted, thank you again.

    – StillSubjectToChange
    Jan 30 at 21:25
















3















How would I go about coloring the top and bottom of a page in ConTeXt/Metafun?



Currently I am using this code



definecolor [Top] [h=00ff00]
definecolor [Bottom] [h=ff0000]
definecolor [TitleColor] [h=0000ff]
setupmakeup [CoverPage] [pagestart=yes]
definehighlight [CoverTitle] [color=TitleColor]

startuseMPgraphic{Head}
StartPage ;
fill Page withcolor MPcolor{Top} ;
StopPage ;
stopuseMPgraphic

defineoverlay[page][useMPgraphic{Head}]
setupbackgrounds[page][background=page]

starttext
startmakeup[CoverPage][doublesided=no]
definedfont[Serif at 20.7pt]setstrut strut Author par
definedfont[Serif at 32.7pt]setstrut strut TitleColor{Cover Page Title} par
% I would like to separate the top and bottom colors here.
definedfont[Serif at 24.9pt]setstrut strut TitleColor{Subhead Title}
stopmakeup
stoptext


Which obviously returns a page with a single color.



I am learning ConTeXt/Metafun, so the above code is "cargo cult"-ish. If there is a better way I would like to know.










share|improve this question




















  • 1





    Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

    – sztruks
    Jan 30 at 20:21











  • Yes, I approximated the code. Sorry about that.

    – StillSubjectToChange
    Jan 30 at 20:22











  • I made an edit to your code. Compiles now.

    – sztruks
    Jan 30 at 20:24








  • 1





    You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

    – Henri Menke
    Jan 30 at 21:24











  • @HenriMenke Noted, thank you again.

    – StillSubjectToChange
    Jan 30 at 21:25














3












3








3








How would I go about coloring the top and bottom of a page in ConTeXt/Metafun?



Currently I am using this code



definecolor [Top] [h=00ff00]
definecolor [Bottom] [h=ff0000]
definecolor [TitleColor] [h=0000ff]
setupmakeup [CoverPage] [pagestart=yes]
definehighlight [CoverTitle] [color=TitleColor]

startuseMPgraphic{Head}
StartPage ;
fill Page withcolor MPcolor{Top} ;
StopPage ;
stopuseMPgraphic

defineoverlay[page][useMPgraphic{Head}]
setupbackgrounds[page][background=page]

starttext
startmakeup[CoverPage][doublesided=no]
definedfont[Serif at 20.7pt]setstrut strut Author par
definedfont[Serif at 32.7pt]setstrut strut TitleColor{Cover Page Title} par
% I would like to separate the top and bottom colors here.
definedfont[Serif at 24.9pt]setstrut strut TitleColor{Subhead Title}
stopmakeup
stoptext


Which obviously returns a page with a single color.



I am learning ConTeXt/Metafun, so the above code is "cargo cult"-ish. If there is a better way I would like to know.










share|improve this question
















How would I go about coloring the top and bottom of a page in ConTeXt/Metafun?



Currently I am using this code



definecolor [Top] [h=00ff00]
definecolor [Bottom] [h=ff0000]
definecolor [TitleColor] [h=0000ff]
setupmakeup [CoverPage] [pagestart=yes]
definehighlight [CoverTitle] [color=TitleColor]

startuseMPgraphic{Head}
StartPage ;
fill Page withcolor MPcolor{Top} ;
StopPage ;
stopuseMPgraphic

defineoverlay[page][useMPgraphic{Head}]
setupbackgrounds[page][background=page]

starttext
startmakeup[CoverPage][doublesided=no]
definedfont[Serif at 20.7pt]setstrut strut Author par
definedfont[Serif at 32.7pt]setstrut strut TitleColor{Cover Page Title} par
% I would like to separate the top and bottom colors here.
definedfont[Serif at 24.9pt]setstrut strut TitleColor{Subhead Title}
stopmakeup
stoptext


Which obviously returns a page with a single color.



I am learning ConTeXt/Metafun, so the above code is "cargo cult"-ish. If there is a better way I would like to know.







context metafun






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 30 at 21:25







StillSubjectToChange

















asked Jan 30 at 19:32









StillSubjectToChangeStillSubjectToChange

185




185








  • 1





    Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

    – sztruks
    Jan 30 at 20:21











  • Yes, I approximated the code. Sorry about that.

    – StillSubjectToChange
    Jan 30 at 20:22











  • I made an edit to your code. Compiles now.

    – sztruks
    Jan 30 at 20:24








  • 1





    You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

    – Henri Menke
    Jan 30 at 21:24











  • @HenriMenke Noted, thank you again.

    – StillSubjectToChange
    Jan 30 at 21:25














  • 1





    Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

    – sztruks
    Jan 30 at 20:21











  • Yes, I approximated the code. Sorry about that.

    – StillSubjectToChange
    Jan 30 at 20:22











  • I made an edit to your code. Compiles now.

    – sztruks
    Jan 30 at 20:24








  • 1





    You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

    – Henri Menke
    Jan 30 at 21:24











  • @HenriMenke Noted, thank you again.

    – StillSubjectToChange
    Jan 30 at 21:25








1




1





Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

– sztruks
Jan 30 at 20:21





Your MWE does not compile on ConTeXt live, because of startmarkup. Do you mean startmakeup ?

– sztruks
Jan 30 at 20:21













Yes, I approximated the code. Sorry about that.

– StillSubjectToChange
Jan 30 at 20:22





Yes, I approximated the code. Sorry about that.

– StillSubjectToChange
Jan 30 at 20:22













I made an edit to your code. Compiles now.

– sztruks
Jan 30 at 20:24







I made an edit to your code. Compiles now.

– sztruks
Jan 30 at 20:24






1




1





You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

– Henri Menke
Jan 30 at 21:24





You don't need setupcolors [state=start]. Colors are enabled by default in ConTeXt MkIV.

– Henri Menke
Jan 30 at 21:24













@HenriMenke Noted, thank you again.

– StillSubjectToChange
Jan 30 at 21:25





@HenriMenke Noted, thank you again.

– StillSubjectToChange
Jan 30 at 21:25










1 Answer
1






active

oldest

votes


















6














For such specific placement requirements it's probably the easiest to just design the whole page in MetaFun. I have also adapted it to look more more “Motion Mountainy”. The picture shows the mountain Matterhorn, the highest peak in Switzerland. It's royalty free and obtained from here: https://pixabay.com/en/matterhorn-snow-mountain-panorama-3051346/



setupbodyfont [minion]

definecolor [Top] [h=a5b291]
definecolor [Bottom] [h=b7c1a7]
definecolor [TitleColor] [h=96433a]

define[1]titlefont{%
setcharacterkerning[extrakerning]%
cap
definedfont[#1]%
ignorespaces
}

starttext

startMPpage

StartPage ;

numeric w ; w := bbwidth(Page) ;
numeric h ; h := bbheight(Page) ;

fill (unitsquare xyscaled (w,.8h)) withcolor MPcolor{Bottom} ;
fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor MPcolor{Top} ;
draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

draw textext.rt("definedfont[Serif at 20.7pt]Author") shifted (.1w,.95h) ;
draw textext.rt("titlefont{Serif at 45.2pt} Cover Page Title") shifted (.1w,.85h) withcolor MPcolor{TitleColor} ;
draw textext.rt("titlefont{SerifBold at 20.7pt} Subhead Title") shifted (.1w,.75h) withcolor MPcolor{TitleColor} ;
draw textext.rt("titlefont{SerifBold at 20.7pt} Another subhead") shifted (.1w,.70h) ;

picture p; p := externalfigure "matterhorn.png" ;
draw p scaled (w/bbwidth p) ;

StopPage ;

stopMPpage

stoptext


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%2f472622%2fcover-page-coloring-in-context%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









    6














    For such specific placement requirements it's probably the easiest to just design the whole page in MetaFun. I have also adapted it to look more more “Motion Mountainy”. The picture shows the mountain Matterhorn, the highest peak in Switzerland. It's royalty free and obtained from here: https://pixabay.com/en/matterhorn-snow-mountain-panorama-3051346/



    setupbodyfont [minion]

    definecolor [Top] [h=a5b291]
    definecolor [Bottom] [h=b7c1a7]
    definecolor [TitleColor] [h=96433a]

    define[1]titlefont{%
    setcharacterkerning[extrakerning]%
    cap
    definedfont[#1]%
    ignorespaces
    }

    starttext

    startMPpage

    StartPage ;

    numeric w ; w := bbwidth(Page) ;
    numeric h ; h := bbheight(Page) ;

    fill (unitsquare xyscaled (w,.8h)) withcolor MPcolor{Bottom} ;
    fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor MPcolor{Top} ;
    draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

    draw textext.rt("definedfont[Serif at 20.7pt]Author") shifted (.1w,.95h) ;
    draw textext.rt("titlefont{Serif at 45.2pt} Cover Page Title") shifted (.1w,.85h) withcolor MPcolor{TitleColor} ;
    draw textext.rt("titlefont{SerifBold at 20.7pt} Subhead Title") shifted (.1w,.75h) withcolor MPcolor{TitleColor} ;
    draw textext.rt("titlefont{SerifBold at 20.7pt} Another subhead") shifted (.1w,.70h) ;

    picture p; p := externalfigure "matterhorn.png" ;
    draw p scaled (w/bbwidth p) ;

    StopPage ;

    stopMPpage

    stoptext


    enter image description here






    share|improve this answer






























      6














      For such specific placement requirements it's probably the easiest to just design the whole page in MetaFun. I have also adapted it to look more more “Motion Mountainy”. The picture shows the mountain Matterhorn, the highest peak in Switzerland. It's royalty free and obtained from here: https://pixabay.com/en/matterhorn-snow-mountain-panorama-3051346/



      setupbodyfont [minion]

      definecolor [Top] [h=a5b291]
      definecolor [Bottom] [h=b7c1a7]
      definecolor [TitleColor] [h=96433a]

      define[1]titlefont{%
      setcharacterkerning[extrakerning]%
      cap
      definedfont[#1]%
      ignorespaces
      }

      starttext

      startMPpage

      StartPage ;

      numeric w ; w := bbwidth(Page) ;
      numeric h ; h := bbheight(Page) ;

      fill (unitsquare xyscaled (w,.8h)) withcolor MPcolor{Bottom} ;
      fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor MPcolor{Top} ;
      draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

      draw textext.rt("definedfont[Serif at 20.7pt]Author") shifted (.1w,.95h) ;
      draw textext.rt("titlefont{Serif at 45.2pt} Cover Page Title") shifted (.1w,.85h) withcolor MPcolor{TitleColor} ;
      draw textext.rt("titlefont{SerifBold at 20.7pt} Subhead Title") shifted (.1w,.75h) withcolor MPcolor{TitleColor} ;
      draw textext.rt("titlefont{SerifBold at 20.7pt} Another subhead") shifted (.1w,.70h) ;

      picture p; p := externalfigure "matterhorn.png" ;
      draw p scaled (w/bbwidth p) ;

      StopPage ;

      stopMPpage

      stoptext


      enter image description here






      share|improve this answer




























        6












        6








        6







        For such specific placement requirements it's probably the easiest to just design the whole page in MetaFun. I have also adapted it to look more more “Motion Mountainy”. The picture shows the mountain Matterhorn, the highest peak in Switzerland. It's royalty free and obtained from here: https://pixabay.com/en/matterhorn-snow-mountain-panorama-3051346/



        setupbodyfont [minion]

        definecolor [Top] [h=a5b291]
        definecolor [Bottom] [h=b7c1a7]
        definecolor [TitleColor] [h=96433a]

        define[1]titlefont{%
        setcharacterkerning[extrakerning]%
        cap
        definedfont[#1]%
        ignorespaces
        }

        starttext

        startMPpage

        StartPage ;

        numeric w ; w := bbwidth(Page) ;
        numeric h ; h := bbheight(Page) ;

        fill (unitsquare xyscaled (w,.8h)) withcolor MPcolor{Bottom} ;
        fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor MPcolor{Top} ;
        draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

        draw textext.rt("definedfont[Serif at 20.7pt]Author") shifted (.1w,.95h) ;
        draw textext.rt("titlefont{Serif at 45.2pt} Cover Page Title") shifted (.1w,.85h) withcolor MPcolor{TitleColor} ;
        draw textext.rt("titlefont{SerifBold at 20.7pt} Subhead Title") shifted (.1w,.75h) withcolor MPcolor{TitleColor} ;
        draw textext.rt("titlefont{SerifBold at 20.7pt} Another subhead") shifted (.1w,.70h) ;

        picture p; p := externalfigure "matterhorn.png" ;
        draw p scaled (w/bbwidth p) ;

        StopPage ;

        stopMPpage

        stoptext


        enter image description here






        share|improve this answer















        For such specific placement requirements it's probably the easiest to just design the whole page in MetaFun. I have also adapted it to look more more “Motion Mountainy”. The picture shows the mountain Matterhorn, the highest peak in Switzerland. It's royalty free and obtained from here: https://pixabay.com/en/matterhorn-snow-mountain-panorama-3051346/



        setupbodyfont [minion]

        definecolor [Top] [h=a5b291]
        definecolor [Bottom] [h=b7c1a7]
        definecolor [TitleColor] [h=96433a]

        define[1]titlefont{%
        setcharacterkerning[extrakerning]%
        cap
        definedfont[#1]%
        ignorespaces
        }

        starttext

        startMPpage

        StartPage ;

        numeric w ; w := bbwidth(Page) ;
        numeric h ; h := bbheight(Page) ;

        fill (unitsquare xyscaled (w,.8h)) withcolor MPcolor{Bottom} ;
        fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor MPcolor{Top} ;
        draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;

        draw textext.rt("definedfont[Serif at 20.7pt]Author") shifted (.1w,.95h) ;
        draw textext.rt("titlefont{Serif at 45.2pt} Cover Page Title") shifted (.1w,.85h) withcolor MPcolor{TitleColor} ;
        draw textext.rt("titlefont{SerifBold at 20.7pt} Subhead Title") shifted (.1w,.75h) withcolor MPcolor{TitleColor} ;
        draw textext.rt("titlefont{SerifBold at 20.7pt} Another subhead") shifted (.1w,.70h) ;

        picture p; p := externalfigure "matterhorn.png" ;
        draw p scaled (w/bbwidth p) ;

        StopPage ;

        stopMPpage

        stoptext


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 31 at 3:09

























        answered Jan 30 at 20:37









        Henri MenkeHenri Menke

        73.2k8162273




        73.2k8162273






























            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%2f472622%2fcover-page-coloring-in-context%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?