- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Data Type - <color-interpolation-method>
CSS <color-interpolation-method> data type determines the color space used when creating a transition between different <color> values. This data type overrides the default color blending for functions such as, color-mix() and linear-gradient().
The interpolation color space defaults to Oklab, while interpolating color values.
Possible Values
<rectangular-color-space> − Keywords srgb, srgb-linear, lab, oklab, XYZ, XYZ-D50, or XYZ-D65 can be used.
<polar-color-space> − Keyword shsl, hwb, lch, or oklch can be used.
<hue-interpolation-method> − The algorithm for interpolating hue. It defaults to the shorter hue. It is optional.
Syntax
<color-interpolation-method>: <rectangular-color-space> | <polar-color-space> | <hue-interpolation-method>;
CSS <color-interpolation-method> - linear-gradient()
The following example demonstrates the use of different color spaces and gradient interpolations using linear-gradient() −
<html> <head> <style> .srgb-gradient { background-image: linear-gradient( to right, rgb(15, 73, 27), rgb(160, 214, 173), rgb(63, 138, 13), rgb(34, 180, 66), rgb(79, 236, 132), ); } .oklab-gradient { background-image: linear-gradient( to right, oklab(45.2% -0.032 -0.312), oklab(48.7% 0.019 -0.224), oklab(52.2% 0.07 -0.137), oklab(55.8% 0.122 -0.049), oklab(59.3% 0.173 0.038), oklab(62.8% 0.225 0.126) ); } .oklch-longer-gradient { background-image: linear-gradient( to right, oklch(45.2% 0.313 264), oklch(46.8% 0.308 243), oklch(48.4% 0.303 221), oklch(50% 0.298 200), oklch(51.6% 0.293 179), oklch(53.2% 0.288 157), oklch(54.8% 0.283 136), oklch(56.4% 0.278 115), oklch(58% 0.273 93), oklch(59.6% 0.268 72) ); } .gradient { height: 60px; width: 50%; } .srgb-gradient { background-image: linear-gradient(in srgb to right, green, yellow); } .oklab-gradient { background-image: linear-gradient(in oklab to right, green, yellow); } .oklch-longer-gradient { background-image: linear-gradient(in oklch longer hue to right, green, yellow); } </style> </head> <body> <div>sRGB:</div> <div class="gradient srgb-gradient"></div> <div>Oklab:</div> <div class="gradient oklab-gradient"></div> <div>Oklch Gradient (with longer hue):</div> <div class="gradient oklch-longer-gradient"></div> </body> </html>
Advertisements
To Continue Learning Please Login
Login with Google