Basic Styles
mixins
base-styles
@mixin base-styles() { ... }
View sourceDescription
Outputs some basic typographic styles If $use-base
is true, the result of this mixin is included in the default nebula.css output.
Parameters
None.
Requires
- [function]
color
- [variable]
body-line-height
- [variable]
type-bold-weight
- [variable]
header-line-height
- [variable]
fancy-ligatures-in-headings
variables
type-bold-weight
$type-bold-weight: bolder !default;
View sourceType
String
Used by
- [mixin]
base-styles
font-variants
$font-variants: ('common-ligatures', 'ordinal', 'oldstyle-nums', 'contextual') !default;
View sourceType
List
Links
fancy-ligatures-in-headings
$fancy-ligatures-in-headings: false !default;
View sourceDescription
Use discretionary(fancier) ligatures for headings, this might be a bit too much for certain fonts, and is therefore off by default.
Type
Boolean
Used by
- [mixin]
base-styles
Borders
mixins
border-rules
@mixin border-rules($scale: 1) { ... }
View sourceDescription
Prints out multiple CSS classes for each $border-properties
and $border-colors
. If $use-borders
is true, the result of this mixin is included in the default nebula.css output.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$scale | Determines the size (in pixels) of the border. This is useful if you want to scale border sizes at a breakpoint. | Number | 1 |
Output
.n-border-accent { border: 1px solid #009CDA; }
.n-border-bottom-accent { border-bottom: 1px solid #009CDA; }
// Also works with gradients (where possible)
.n-border-gradient {
border: 1px solid #F9A03D;
border-image: linear-gradient(-180deg, #FBDA61 0%, #F76B1C 100%) 1;
}
.n-border-bottom-gradient { border-bottom: 1px solid #F9A03D; }
Throws
Can not generate #{$propertyName} class for color “#{$color}”, because it was not found in the $colors variable.
Requires
- [function]
color
- [variable]
border-colors
- [variable]
border-properties
- [variable]
colors
- [variable]
class-prefix
variables
border-colors
$border-colors: () !default;
View sourceDescription
an array of color names that should get border classes. Nebula will then look up that color in the $colors map and use that.
Type
List
Example
$border-colors: ('accent', 'black');
Used by
- [mixin]
border-rules
border-size
$border-size: 1 !default;
View sourceDescription
Default size in pixels for borders when they are generated.
Type
Number
border-properties
$border-properties: ('border', 'border-bottom') !default;
View sourceDescription
List of properties that should be generated by @border-rules. For example, assuming the existence of an 'accent' color, the default value ('border', 'border-bottom')
will generate .n-border-accent
, and .n-border-bottom-accent
. If one of the colors is a gradient, it will use the fallback color for every property other than border
;
Type
List
Used by
- [mixin]
border-rules
Colors
mixins
color-rules
@mixin color-rules() { ... }
View sourceDescription
Prints out text-color and background-color classes for every $colors
in Nebula's configuration. You probably only need to use this once, and If $use-colors
is true, the result of this mixin is included in the default nebula.css output.
Parameters
None.
Output
// For every $color, e.g. red:
.n-color-red { color: #B5200F; }
.n-background-red { background-color: #B5200F; }
Requires
- [variable]
class-prefix
- [variable]
colors
variables
colors
$colors: (
'accent' : #009CDA,
'background': #FFFFFF,
'black' : #262626,
) !default;
View sourceType
Map
Example
// Additionally, you can pass a Sass List with a value, which allows you
// to pass along a gradient:
$colors: (
// The first parameter is the fallback that is used for text.
// The second the gradient that will be used
'gradient' : (#F9A03D, linear-gradient(-180deg, #FBDA61 0%, #F76B1C 100%))
…
)
Used by
- [mixin]
border-rules
- [mixin]
color-rules
- [function]
color
functions
color
@function color($name) { ... }
View sourceDescription
Retrieves the value of a color from your configuration.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$name | Name of the color to retrieve value for. | String | —none |
Example
.special-button { background: color('accent'); }
Requires
- [variable]
colors
Used by
- [mixin]
base-styles
- [mixin]
border-rules
Helper Classes
mixins
helper-classes
@mixin helper-classes() { ... }
View sourceDescription
Exports some basic helper classes to aid in development. If $use-helper-classes
is true, the result of this mixin is included in the default nebula.css output.
Parameters
None.
Output
.n-text-centered {} // Centers text
.n-block-centered {} // Centers a block element
.n-inline {} // Turns a block element into an inline element
.n-clear {} // Applies a clearfix to the element
.n--small-caps {} // Uses small-capitals, or synthesises them if not supported by font.
.n-hide-on-mobile {} // Hides element if viewport width < `$breakpoint-hide-on-mobile`
.n-show-on-mobile {} // Shows element only if viewport width < `$breakpoint-hide-on-mobile`
Requires
- [variable]
class-prefix
- [variable]
breakpoint-hide-on-mobile
— Determines what viewport width the `hide-on-mobile` and `show-on-mobile` classes kick in.
List
mixins
list-classes
@mixin list-classes() { ... }
View sourceDescription
By default, Nebula's reset stylesheet removes any styling of lists. This allows you to use semantic lists for non-text elements.
To use traditional list, you can use the .n-ul
and .n-ol
classes created by this mixin. If $use-lists
is true, the result of this mixin is included in the default nebula.css output.
Parameters
None.
Output
.n-ul { list-style: disc outside; }
.n-ol { list-style: decimal outside; }
Requires
- [function]
space
- [variable]
class-prefix
Modularity
variables
use-reset
$use-reset: true !default;
View sourceDescription
Toggles the creation of reset classes in the output css
Type
Boolean
use-base
$use-base: true !default;
View sourceDescription
Toggles the output of basic styling and typography in the output css
Type
Boolean
See
- [mixin]
base-styles
use-borders
$use-borders: true !default;
View sourceDescription
Toggles the output of border classes in the output css
Type
Boolean
See
- [mixin]
border-rules
use-colors
$use-colors: true !default;
View sourceDescription
Toggles the output of color classes in the output css
Type
Boolean
See
- [mixin]
color-rules
use-helper-classes
$use-helper-classes: true !default;
View sourceDescription
Toggles the output of basic helper classes in the output css
Type
Boolean
See
- [mixin]
helper-classes
use-lists
$use-lists: true !default;
View sourceDescription
Toggles the output of list-related classes in the output css
Type
Boolean
See
- [mixin]
list-classes
use-spacing
$use-spacing: true !default;
View sourceDescription
Toggles the output of spacing classes in the output css
Type
Boolean
See
- [mixin]
scale-spacing
use-typography
$use-typography: true !default;
View sourceDescription
Toggles the output of typography and font-size classes in the output css
Type
Boolean
See
- [mixin]
scale-type
Spacing
variables
spacing-values
$spacing-values: (
'smallest': 5,
'small' : 20,
'medium' : 40,
'large' : 70,
) !default;
View sourceType
Map
Used by
- [mixin]
scale-spacing
spacing-directions
$spacing-directions: ('top', 'bottom') !default;
View sourceDescription
Determines which extra “directions” to generate spacing classes for (besides “all”, vertical, and horizontal)
Type
List
Example
.n-spacing-top-medium {}
.n-spacing-bottom-medium {}
.n-padding-top-medium {}
.n-padding-bottom-medium {}
Used by
- [mixin]
rules-for-space-value
mixins
scale-spacing
@mixin scale-spacing($vSpacingScale) { ... }
View sourceDescription
Generate spacing rules for a specific scale. This will take the value defined for each item in $spacing-values
, and multiply it by a number. Useful for adjusting spacing at different breakpoints. If either parameter is left empty, spacing for that direction will not be affected (see rules-for-space-value
). If $use-spacing
is true, the output this mixin with the parameters scale-spacing(1,1)
is included in the default nebula.css output.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$vSpacingScale | Multiplier for the vertical spacing that is generated. Optional. | Number | —none |
Output
// Assuming, and the example above:
$spacing-values: ('medium': 20, 'large': 40);
@include scale-spacing(1.5, 1);
// results in:
@include rules-for-space-value('medium', 30, 20);
@include rules-for-space-value('large', 60, 40);
@include scale-spacing(.5);
// results in:
@include rules-for-space-value('medium', 10, 10);
@include rules-for-space-value('large', 20, 20);
Requires
- [mixin]
rules-for-space-value
- [variable]
spacing-values
rules-for-space-value
@mixin rules-for-space-value($name, $vvalue, $hvalue) { ... }
View sourceDescription
Mixin that prints out multiple CSS classes for managing spacing between and within elements. Depending on values in the $spacing-directions
list, it will generate additional classes for specific directions. By default this adds spacing classes for the top and bottom.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$name | The size's 'name', will be represented in the classname generated | String | —none |
$vvalue | Amount of vertical spacing applied | Number | —none |
$hvalue | Amount of horizontal spacing applied | Number | —none |
Output
.n-spacing-$name {} // (margin on all sides)
.n-vspacing-$name {} // (vertical margins only)
.n-hspacing-$name {} // (horizontal margins)
.n-padding-$name {} // (padding on all sides)
.n-vpadding-$name {} // (vertical padding only)
.n-hpadding-$name {} // (horizontal padding)
// For working with items in a grid:
.n-frame-$name {} // (negative margins)
// Additionally, based on $spacing-directions:
.n-spacing-top-$name {}
.n-spacing-bottom-$name {}
.n-padding-top-$name {}
.n-padding-bottom-$name {}
// If either `$vvalue` or `$hvalue` parameter is left empty,
// the mixin wil omit output regarding that direction:
@include rules-for-space-value('medium', null, 40);
// Outputs:
.n-spacing-medium { margin-left: 40px; margin-right: 40px; }
.n-hspacing-medium { margin-left: 40px; margin-right: 40px; }
.n-padding-medium { padding-left: 40px; padding-right: 40px; }
.n-hpadding-medium { margin-left: 40px; margin-right: 40px; }
Requires
- [variable]
class-prefix
- [variable]
spacing-directions
Used by
- [mixin]
scale-spacing
See
- [mixin]
scale-spacing
functions
space
@function space($name) { ... }
View sourceDescription
Retrieves the value of a spacing value from your configuration. Please note that this value does not scale when @include scale-spacing()
is used.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$name | Name of the spacing value to retrieve value for. | String | —none |
Used by
- [mixin]
list-classes
Typography
variables
body-line-height
$body-line-height: 1.4 !default;
View sourceType
Number
Used by
- [mixin]
base-styles
font-base-sizes
$font-base-sizes: (
'normal' : 18,
'small' : 15,
'smallest': 12.5,
) !default;
View sourceType
Map
Used by
- [mixin]
scale-type
header-line-height
$header-line-height: 1.2 !default;
View sourceType
Number
Used by
- [mixin]
base-styles
header-base-sizes
$header-base-sizes: (31, 26, 21.5) !default;
View sourceType
List
Used by
- [mixin]
scale-type
mixins
scale-type
@mixin scale-type($bodyTextScale: 1, $headerTextScale: $bodyTextScale) { ... }
View sourceDescription
Generates typography classes for a scale parameter. This looks up every font size and multiplies it with the scale value. Useful for adjusting font size at a breakpoint.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$bodyTextScale | Scale multiplier for body text (based on | Number | 1 |
$headerTextScale | Scale multiplier for header texts (based on | Number | $bodyTextScale |
Example
@media screen and (min-width: $breakpoint-widescreen) {
@include scale-type($bodyTextScale: 1.2);
}
Output
@media screen and (min-width: 1280px) {
body { font-size: 21.6px; }
.n-type-normal { font-size: 21.6px; }
.n-type-small { font-size: 18px; }
.n-type-smallest { font-size: 12.52px; }
h1, .n-type-h1 { font-size: 37.2px; }
h2, .n-type-h2 { font-size: 31.2px; }
h3, .n-type-h3 { font-size: 25.2px; }
}
Requires
- [variable]
header-base-sizes
- [variable]
class-prefix
- [variable]
font-base-sizes
functions
font-size
@function font-size($name) { ... }
View sourceDescription
Retrieves the value of a font size from your configuration. Please note that this value does not scale when @include scale-type()
is used.
Parameters
parameterName | parameterDescription | parameterType | parameterDefault value |
---|---|---|---|
$name | Name of the font size to retrieve value for. | String | —none |
Example
footer { font-size: font-size('small'); }
See
- [variable]
font-base-sizes
General
variables
class-prefix
$class-prefix: 'n' !default;
View sourceDescription
The text prefixed to all of the classes generated by Nebula. In some cases you might change this to something like L
or UI
.
Type
String
Used by
- [mixin]
border-rules
- [mixin]
color-rules
- [mixin]
helper-classes
- [mixin]
list-classes
- [mixin]
rules-for-space-value
- [mixin]
scale-type
breakpoint-hide-on-mobile
$breakpoint-hide-on-mobile: 400px !default;
View sourceDescription
Used together with the .n-hide-on-mobile
and .n-show-on-mobile
classes, will either hide or show content depending on the value of this breakpoint.
Type
Number
See
- [mixin]
helper-classes
Used by
- [mixin]
helper-classes
breakpoint-mobile
$breakpoint-mobile: 400px !default;
View sourceType
Number
breakpoint-tablet
$breakpoint-tablet: 700px !default;
View sourceType
Number
breakpoint-widescreen
$breakpoint-widescreen: 1200px !default;
View sourceType
Number