San Antonio Express-News graphic style guide

Overview

The goal of this style guide is to provide a flexible framework for all Data Team graphic projects. This wiki should act as a reference. However, the style guide repo also provides a suite of style files that can be installed via NPM and utilized as a boilerplate styling framework for your projects.

This repo comes with versioning and is installable via npm.

Inspiration is pulled liberally from the SF Chronicle and Texas Tribune news app templates.

Installing the style files

npm install --save-dev express-news-styleguide

Utilizing the style files

The style files are written in SCSS — a Sass syntax that builds on the existing CSS syntax. If you're unfamiliar with Sass or SCSS, read this guide to catch up on the basics.

On its first iteration, the style files are broken into two folders – base and theme. Currently theme contains just one file, graphic.scss, which operates as a boilerplate that can be used with c3 and graphicBuilder graphics. Learn more about how base is structured here.

If installing via NPM, you can access the style files in your project's .scss files like this:

@import 'node_modules/express-news-styleguide/init-base';
@import 'node_modules/express-news-styleguide/theme/graphic';

Typography

The most important rule to remember with typography is that, in graphics, we use a sans-serif font. This includes for the header, the chatter and anywhere else in the graphic. Since our regular text is serif, this allows us to differentiate graphic blocks and copy from regular text and headers.

With this in mind, we generally utilize three fonts. These are as follows:

Two of those fonts will need to be imported from Google Fonts. That can be done in two ways:

Font sizes are flexible at the moment. However, if we assume the baseline font size to be 14px, we can say that in most cases:

Graphic color schemes

At least for the moment, we haven't set any definitive styles for graphic colors. That being said, we do have a graphic color chart that you can use to help pick logical color combinations. It looks like this:

You can download the graphic color chart (and view it in more detail with hex and RGB codes) by clicking here.

We also support the use of ColorBrewer color schemes.

Political colors

When 'tis the season, here are the colors to use:

Standard ExpressNews colors

Colors should match those utilized in the story template and/or those in your graphic depending on proximity. This being said, there are two colors we use frequently on E-N.com:

Longform Colors

The longform React template comes with its own unique color scheme. For reference, here are the colors associated with that template:

Understand the SASS variables

Each color discussed above, including all those in the graphic color chart, is available as a SASS variables in the ExpressNews style guide. If you download this style guide via NPM, you can utilize the variables in your project and modify them as you see fit for the circumstance.

If you are new to SASS, you can learn more here.

Understand The Base .SCSS Files

Everything you need to jump start a project is contained in the base folder. Here's an explanation of each of the partials:

_base.scss

These are the only styles applied directly to HTML elements. If you really need a clean slate, don't use this partial. But it's helpful for normalizing styles and inheriting basic news apps prose styles without using additional classes.

_colors.scss:

All of our colors are assigned to $variables, most of which have a descriptive name to help you decide when to use it. For example, $rep-red and $dem-blue are used for typical political party designations.

_tables.scss:

This partial contains one mixin to rule them all — i.e. all the variations of mobile table styles. Skip to Tables to learn more.

_typography.scss:

Our style guide has a modular typography system. By changing the size $variables, you can change font-sizes across the entire project. The system also allows you to designate font-size with .classes in your HTML or @extend %font-sizes on new classes.

Tables

I will need to build out proper examples of how to use the table styling, but I think it will really help to speed up our efforts in building flexible mobile first tables. The style file is viewable here.