0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

css でお手軽に Text Style Theme を設定する

Last updated at Posted at 2017-10-13

ひっさしぶりに scss とか sass 触った時に、Android 的な テキスト用のスタイリングをまとめる時のやり方を簡単に書く方法をメモ

$TextVariations: (
  Title: 36,
  Heading: 24,
  SubHeading: 18,
  Body: 16,
  Caption: 14,
  Hint: 12
);

$TextColors: (
  Theme: #foo,
  Default: #zoo,
  Aux: #bar
);

@each $textClass, $fontSize in $TextVariations {
  @each $colorClass, $color in $TextColors {
    %#{$textClass}#{$colorClass} {
      font-size: $fontSize;
      color: $color;
    }
    %#{$textClass}#{$colorClass}Bold {
      font-size: $fontSize;
      color: $color;
      font-weight: bold;
    }      
  }
}

と書いて
各所で

span {
  @extend %TitleDefault
}

とか書けばどこでも使える。scss って楽ンゴ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?