grayscale()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
grayscale()
は CSS の関数は、入力画像をグレースケールに変換します。結果は <filter-function>
です。
試してみましょう
構文
css
grayscale(amount)
引数
amount
-
入力画像がグレースケールに変換される度合いです。
<number>
または<percentage>
で指定します。100%
の値では完全にグレースケールになり、0%
の値では入力が変更されないままになります。0%
と100%
の間の値は、その効果に対する線形の倍数です。省略時の既定値は1
です。補間の初期値は0
です。
例
grayscale() の正しい値の例
css
grayscale(0) /* 効果なし */
grayscale(.7) /* 70% グレースケール */
grayscale(100%) /* 完全なグレースケール */
仕様書
Specification |
---|
Filter Effects Module Level 1 # funcdef-filter-grayscale |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
grayscale() |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
その他の filter
および backdrop-filter
プロパティの値で使用できる <filter-function>
関数には、次のものがあります。