Skip to content

Glk Stylesheets: The Short Form

erkyrath edited this page Jan 31, 2012 · 3 revisions

Glk Stylesheets: The Short Form

(for people who don't want to read about CSS or HTML or anything, they just want it to work)

For standard styles you just write

say "Line of [italic type]text[/italic type].";

Pretty much the same as before, except that you can nest styles, so there are open and close style tags. (The exact wording of say phrases is not yet determined.)

To define a brand-new style, you'll write something like

Computer voice is a text style.

Or you might do it this way:

Chapter title is a text style based on Header.

This tells the game that it can fall back to the standard "Header" style, if the interpreter doesn't support all this crazy new CSS stuff.

You can then write code like:

say "[Chapter title style]Chapter 1: The Monkeying[/Chapter title style].";
say "The robot says, [Computer voice style]'Exterminate, dude.'[/Computer voice style]";

To define how the style looks, you write a CSS stylesheet file -- or, more likely, take a standard CSS file and add a few lines. In this case you might add lines like this:

.Div_ChapterTitle {
	text-align: center;
	font-size: 1.5em;
}
.Span_ComputerVoice {
	color: green;
	font-family: Courier, monospace;
}

That makes the chapter title centered in a large font size; the robot style is green and uses the Courier font. (Or any fixed-width font, if Courier isn't available.)

I won't try to explain CSS syntax here, but there's plenty of online documentation about it. You can also write CSS lines that control the appearance of all the text in a window, or all the text in all windows -- it's flexible.

We expect there to be many nice-looking CSS stylesheets floating around (as contributions), that cover the standard styles. You can use or modify them for your games. A player can also use or modify them -- this will be a standard way to load display preferences into your interpreter. If you really want to play all IF games with a particular font and color set, you can do that.