1.0.7 • Published 9 months ago

lkt-theme v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

LKT Theme

The semantic themes tool!

This package can help handling most common and reusable theme props and in a sharable and collaborative way with the rest of the team.

Colors

Available colors

ColorUse case
primaryThis is your brand main color
secondaryIf your brand has a secondary color, this is the place
infoGive the user some info
warningWarn the user
successEverything is ok
dangerSomething bad could happen
alertSomething bad happened
targetGoals
focusFocus inputs
noticeAnother informative color
importantFor important stuff
textMain text color. I recommend using this alternative color as main background
grayYour grayscale colors

Available Colors Modifiers

ModifiersUse case
contrastContrast color. For example, the default background for this color in a button
lightA light version of the color
lighterA lighter version of the color
darkA dark version of the color
darkerA darker version of the color

Methods

Each color has a configuration mixin with this structure:

lkt-theme.set-<colorName>-color(color, contrast)

// For example:

lkt-theme.set-secondary-color(...)
lkt-theme.set-alert-color(...)
lkt-theme.set-warning-color(...)
...

Colors configuration

@use "node_modules/lkt-theme/lkt-theme";

@include lkt-theme.set-primary-color(#ff0000, #ffffff);
@include lkt-theme.set-secondary-color(blue, green);

Colors usage

@use "node_modules/lkt-theme/lkt-theme";

body {
  color: lkt-theme.$text-color;
  background: lkt-theme.$text-color-contrast;
}

button.success {
  color: lkt-theme.$success-color;
  background: lkt-theme.$success-color-contrast;
}

button.success-light {
  color: lkt-theme.$success-color-light;
  background: lkt-theme.$success-color-light-contrast;
}

Advanced colors usage

There is a function named get-color-map which will return a map of maps with all the colors. The map structure it's like following:

(
    name1: (color: name1-color, contrast: name1-color),
    name2: (color: name2-color, contrast: name2-color),
    ...
    nameN: (color: nameN-color, contrast: nameN-color),
)

For example:

@include lkt-theme.set-primary-color(#ff0000, #ffffff);
@include lkt-theme.set-primary-color-dark(#ff0022, #ffffff);
@include lkt-theme.set-gray-color(#cccccc, #ffffff);

$colors: lkt-theme.get-color-map();

// $colors content:

(
    primary: (color: #ff0000, contrast: #ffffff),
    primary-dark: (color: #ff0022, contrast: #ffffff),
    primary-gray: (color: #cccccc, contrast: #ffffff),
)

This is useful to iterate and generate modifiers to existing CSS selectors:

.item {
  @each $code, $palette in $colors {
    $color: map-get($palette, color);
    $contrast: map-get($palette, contrast);
      
    &.#{$code} {
      color: $color;
      background: $contrast;
    }
  }
}

// Will generate the following output:
.item.primary {
  color: #ff0000;
  background: #ffffff; }
.item.primary-dark {
  color: #ff0022;
  background: #ffffff; }
.item.gray {
  color: #cccccc;
  background: #ff0000; }

Border radius

Available border radius

ColorUse case
primaryThe main border radius in your project
secondaryAdditional border radius
tertiaryAnother one just in case

Methods

There is a mixin to configure all three border radius

lkt-theme.set-border-radius(primary, secondary, tertiary)

Border radius configuration

@use "node_modules/lkt-theme/lkt-theme";

@include lkt-theme.set-border-radius(1px, 2px, 4px);

Border radius usage

@use "node_modules/lkt-theme/lkt-theme";


button.success {
  border-radius: lkt-theme.$primary-border-radius;
}

Transitions

Available transitions

ColorUse case
primaryThe main transition in your project
secondaryAdditional transition
tertiaryAnother one just in case

Methods

There is a mixin to configure all three transitions

lkt-theme.set-transition(primary, secondary, tertiary)

Transition configuration

@use "node_modules/lkt-theme/lkt-theme";

@include lkt-theme.set-transition(200ms all linear, false, 5s color linear);

Border transition

@use "node_modules/lkt-theme/lkt-theme";


button.success {
  transition: lkt-theme.$primary-transition;
}

Font sizes

Available font sizes

ColorUse case
primaryThe main font-size in your project
secondaryAdditional font-size
tertiaryAnother one just in case

Methods

There is a mixin to configure all three font-sizes

lkt-theme.set-font-size(primary, secondary, tertiary)

Font-size configuration

@use "node_modules/lkt-theme/lkt-theme";

@include lkt-theme.set-font-size(16px, 20px, 17px); // Sample

Font-size usage

@use "node_modules/lkt-theme/lkt-theme";


button.success {
  font-size: lkt-theme.$primary-font-size;
}

Font families

Available font families

ColorUse case
primary-headerThe main font-family (for headers) in your project
secondary-headerAdditional font-family (for headers)
tertiary-headerAnother one just in case (for headers)
primary-textThe main font-family in your project (for text)
secondary-textAdditional font-family (for text)
tertiary-textAnother one just in case (for text)
primary-buttonThe main font-family in your project (for buttons)
secondary-buttonAdditional font-family (for buttons)
tertiary-buttonAnother one just in case (for buttons)

Methods

There are three mixins to configure all font families

lkt-theme.set-header-font-family(primary, secondary, tertiary)
lkt-theme.set-text-font-family(primary, secondary, tertiary)
lkt-theme.set-button-font-family(primary, secondary, tertiary)

Font-family configuration

@use "node_modules/lkt-theme/lkt-theme";

@include lkt-theme.set-button-font-family(Arial); // Sample

Font-family usage

@use "node_modules/lkt-theme/lkt-theme";


button.success {
  font-family: lkt-theme.$primary-button-font-family;
}