StyleSheetConstants

Package: Libraries.Web.Styles · Inherits from: Libraries.Language.Object

StyleSheetConstants holds fixed values that every layout and style uses when it writes its part of a stylesheet. It is a shared class, so there is only ever one copy, however many layouts and styles use it.

Example Code

use Libraries.Web.Styles.StyleSheetConstants

StyleSheetConstants constants
output "Pixels in one width of M: " + constants:PIXELS_PER_WIDTH_OF_M

Variables

  • number SPACING_8
  • number SPACING_6
  • number SMALL_LINE_HEIGHT
  • number SPACING_2
  • number SPACING_72
  • number EXTRA_LARGE_3_FONT_SIZE
  • integer UNSET_POSITION: Where a list's markers sit: not chosen yet (the default, which writes nothing), outside the items' text, or inside it. List styles store one of these; authors choose with MarkersOutside or MarkersInside.
  • number SPACING_44
  • integer NUMBER_MARKER
  • number PIXELS_PER_WIDTH_OF_M: The number of pixels in one width of M at the browser's normal text size. In a stylesheet this unit is written "rem", short for "root em". An "em" is a printer's measure, named after the width of a capital M. On the web, one rem is the text size of the whole page: 16 pixels, unless the reader has made text larger or smaller in their browser.
  • number EXTRA_LARGE_4_FONT_SIZE
  • integer OUTSIDE_POSITION
  • number SPACING_11
  • number EXTRA_SMALL_LINE_HEIGHT
  • number SPACING_7
  • number SPACING_2_5
  • integer LIGHT_FONT_WEIGHT: Font weights, from light to bold.
  • number SPACING_4
  • number SMALL_FONT_SIZE
  • number EXTRA_LARGE_7_FONT_SIZE
  • number EXTRA_LARGE_9_FONT_SIZE
  • number SPACING_3
  • number SPACING_48
  • number EXTRA_LARGE_2_LINE_HEIGHT
  • integer SEMIBOLD_FONT_WEIGHT
  • integer MEDIUM_FONT_WEIGHT
  • number SPACING_32
  • number BASE_LINE_HEIGHT
  • number LARGE_FONT_SIZE
  • number SPACING_96: Screen widths, in pixels, where a page's look may change: a look set "from" one of these applies on screens at least that wide. A small screen is a large phone turned sideways or a small tablet; a large screen, a laptop.
  • number EXTRA_LARGE_7_LINE_HEIGHT
  • number SPACING_28
  • integer UNSET_MARKER: The marker a list puts before each item: none chosen yet (the default, which writes nothing), discs, numbers, or no marker at all. List styles store one of these; authors choose with actions such as UseDiscs, never with these numbers.
  • number SPACING_0: Spacing, in pixels, for gaps, padding and margins, on a scale common on the web. Each step is 4 pixels: SPACING_2 is 8 pixels, SPACING_4 is 16. SPACING_0_5 is half a step (2 pixels), and SPACING_PIXEL is one pixel.
  • number SPACING_56
  • number EXTRA_LARGE_5_LINE_HEIGHT
  • number SPACING_64
  • integer CENTER_ALIGN
  • number EXTRA_LARGE_9_LINE_HEIGHT: Font weights, from light to bold.
  • number EXTRA_LARGE_6_LINE_HEIGHT
  • number EXTRA_LARGE_SCREEN_WIDTH: Turns a size in pixels into text a stylesheet can use, measured in widths of the letter M (written "rem"; see PIXELS_PER_WIDTH_OF_M). Sizes written this way grow and shrink with the reader's text size, so 8 pixels becomes "0.5rem". Every layout and style uses this, so they all convert sizes the same way.
  • number EXTRA_LARGE_FONT_SIZE
  • number SPACING_40
  • number SPACING_5
  • integer DISC_MARKER
  • number BASE_FONT_SIZE
  • number SPACING_1
  • integer LEFT_ALIGN: How a layout lines up its items across: stretched to the full width (the default), or at their own width on the left, in the center or on the right. Layouts store one of these; authors choose with actions such as AlignCenter, never with these numbers.
  • number SPACING_52
  • integer RIGHT_ALIGN: The marker a list puts before each item: none chosen yet (the default, which writes nothing), discs, numbers, or no marker at all. List styles store one of these; authors choose with actions such as UseDiscs, never with these numbers.
  • number EXTRA_SMALL_FONT_SIZE: Text sizes, in pixels, from extra small to very large, on a scale common on the web. Each size has a font size and the line height that reads well with it.
  • number LARGE_SCREEN_WIDTH
  • integer INSIDE_POSITION: Text sizes, in pixels, from extra small to very large, on a scale common on the web. Each size has a font size and the line height that reads well with it.
  • number EXTRA_LARGE_3_LINE_HEIGHT
  • number SPACING_14
  • number EXTRA_LARGE_6_FONT_SIZE
  • number EXTRA_LARGE_4_LINE_HEIGHT
  • number SPACING_80
  • number SPACING_0_5
  • number EXTRA_LARGE_5_FONT_SIZE
  • number SPACING_3_5
  • number SPACING_12
  • number EXTRA_LARGE_8_FONT_SIZE
  • integer NO_MARKER: Where a list's markers sit: not chosen yet (the default, which writes nothing), outside the items' text, or inside it. List styles store one of these; authors choose with MarkersOutside or MarkersInside.
  • number EXTRA_LARGE_2_FONT_SIZE
  • integer BOLD_FONT_WEIGHT: Spacing, in pixels, for gaps, padding and margins, on a scale common on the web. Each step is 4 pixels: SPACING_2 is 8 pixels, SPACING_4 is 16. SPACING_0_5 is half a step (2 pixels), and SPACING_PIXEL is one pixel.
  • number SPACING_16
  • number SPACING_20
  • number EXTRA_LARGE_8_LINE_HEIGHT
  • number SPACING_10
  • number SPACING_24
  • integer NORMAL_FONT_WEIGHT
  • number SPACING_PIXEL
  • number SPACING_1_5
  • number SMALL_SCREEN_WIDTH: Screen widths, in pixels, where a page's look may change: a look set "from" one of these applies on screens at least that wide. A small screen is a large phone turned sideways or a small tablet; a large screen, a laptop.
  • integer STRETCH_ALIGN: How a layout lines up its items across: stretched to the full width (the default), or at their own width on the left, in the center or on the right. Layouts store one of these; authors choose with actions such as AlignCenter, never with these numbers.
  • number SPACING_9
  • number SPACING_36
  • number SPACING_60
  • number EXTRA_LARGE_LINE_HEIGHT
  • number LARGE_LINE_HEIGHT
  • number MEDIUM_SCREEN_WIDTH

Actions

ToWidthOfM(number pixels)

Turns a size in pixels into text a stylesheet can use, measured in widths of the letter M (written "rem"; see PIXELS_PER_WIDTH_OF_M). Sizes written this way grow and shrink with the reader's text size, so 8 pixels becomes "0.5rem". Every layout and style uses this, so they all convert sizes the same way.

Parameters

  • pixels number: A size in pixels, at the browser's normal text size.

Returns

text: The same size, as stylesheet text, such as "0.5rem".

Example

use Libraries.Web.Styles.StyleSheetConstants

StyleSheetConstants constants
output constants:ToWidthOfM(8)

Inherited Actions

3 actions from Libraries.Language.Object