useCssVar 
CSS変数を操作する
デモ 
使い方 
js
import { useCssVar } from '@vueuse/core'
const el = ref(null)
const color1 = useCssVar('--color', el)
const elv = ref(null)
const key = ref('--color')
const colorVal = useCssVar(key, elv)
const someEl = ref(null)
const color2 = useCssVar('--color', someEl, { initialValue: '#eee' })型宣言 
typescript
export interface UseCssVarOptions extends ConfigurableWindow {
  initialValue?: string
  /**
   * Use MutationObserver to monitor variable changes
   * @default false
   */
  observe?: boolean
}
/**
 * Manipulate CSS variables.
 *
 * @see https://vueuse.dokyumento.jp/useCssVar
 * @param prop
 * @param target
 * @param options
 */
export declare function useCssVar(
  prop: MaybeRefOrGetter<string | null | undefined>,
  target?: MaybeElementRef,
  options?: UseCssVarOptions,
): Ref<string | null | undefined, string | null | undefined>ソース 
コントリビューター 
変更履歴 
v12.0.0-beta.1 2024年11月21日v11.0.2 2024年8月24日v11.0.0-beta.2 2024年7月17日v10.2.0 2023/06/16 リリースv10.0.2 2023/04/14 リリースv10.0.0-beta.4 2023/04/13 リリース4d757 - feat(types)!: MaybeComputedRef を MaybeRefOrGetter にリネーム0a72b - feat(toValue): resolveUnref を toValue にリネームv10.0.0-beta.0 2023/03/14 リリース