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 1 year has passed since last update.

vuetifyのカスタムカラーをvarで利用する

Posted at

version
vue@3.2
vuetify@3.1

vuetifyでカスタムテーマを定義することありますよね。
特に色なんかはclassに埋めれば使えるようにしてほしいですが反映されない時がありますいまだに仕様が謎

そんな時は最終手段としてvarで呼び出しましょう。
vuetifyのカスタムテーマはcssのルートに変数で定義されるのでvarで呼び出せるみたいです

Let's Go

カスタムカラー

vuetify.ts
 theme: {
      defaultTheme: 'light',
      themes: {
        light: {
          colors: {
            'aka': '#FF98BD',
          },
        },
      },
  }

ポイントはrgbに入れることです

hoge.vue
<style>
.aka {
  color: rgb(var(--v-theme-aka))
}
</style>
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?