Cover page coloring in ConTeXt
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
add a comment |
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
1
Your MWE does not compile on ConTeXt live, because ofstartmarkup
. Do you meanstartmakeup
?
– 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 needsetupcolors [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
add a comment |
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
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
context metafun
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 ofstartmarkup
. Do you meanstartmakeup
?
– 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 needsetupcolors [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
add a comment |
1
Your MWE does not compile on ConTeXt live, because ofstartmarkup
. Do you meanstartmakeup
?
– 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 needsetupcolors [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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Jan 31 at 3:09
answered Jan 30 at 20:37
Henri MenkeHenri Menke
73.2k8162273
73.2k8162273
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
Your MWE does not compile on ConTeXt live, because of
startmarkup
. Do you meanstartmakeup
?– 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