Migration guide for @uploadcare/blocks v0.44.0
BREAKING CHANGES
- All theme variables of the previous version are deprecated and won’t affect the look anymore.
- The default button that opens the uploader dialog (
SimpleBtn
) component now uses independent variables. - By default, the theme now uses OKLCH color space. You can still override it using other color spaces, but we recommend converting your colors to OKLCH.
How to migrate
Dark and light mode
CSS variable --darkmode
won’t affect color scheme anymore. Now, the theme is
determined by user preference by default. To force a color scheme, apply
uc-light
or uc-dark
class to the component.
- If you are using light mode only, apply
uc-light
class to the component. - If you are using dark mode only, apply
uc-dark
class to the component. - If you apply user system preference, you don’t have to do anything. You can
safely delete any code that uses
--darkmode
variable.
Case 1 - you’re not using --darkmode
variable
The light mode was previously the default theme. If you want to keep it, apply the
uc-light
class to the component.
Case 2 - you are using --darkmode
variable to constantly apply dark mode
If you want to keep dark mode, apply the uc-dark
class to the component.
Case 3 - you are using --darkmode
variable to apply dark mode only when the user prefers it
For example, you are using this code:
Now, you can safely delete it. The mode is determined by user preference by default.
Accent colors
Case 1 - you’re not using --*-accent
variables
In this case, you don’t have to do anything. The default accent color is used.
Case 2 - you’re using --*-accent
variables
For example, you have this code:
First, you need to convert your accent color from HSL to OKLCH. We recommend using https://oklch.com/ for conversion.
Then, depending on your use of light or dark mode, change the following variables. Write values only:
Note: to maintain the contrast, don’t change first numbers that stand for lightness.
Other colors and variables
Case 1 - you’re not using CSS variables other than --*-accent
In this case, you don’t have to do anything. The default values will be used.
Case 2 - you’re using CSS variables other than --*-accent
The new styling system does not directly replace most of the values. Yet, using this guide can yield very close results.
- Convert your colors from HSL to OKLCH. We recommend using https://oklch.com/ for conversion.
- Assign OKLCH colors to correspondent variables using this table. If you use
only light or only dark mode, override the variable with the respective suffix:
-light
or-dark
.
Derivative values
Case 1 - you’re not using derivative values described below
In this case, you don’t have to do anything. The default values will be used.
Case 2 - you’re using derivative values described below
- Convert your colors from HSL to OKLCH. We recommend using https://oklch.com/ for conversion.
- Assign OKLCH colors to correspondent variables using this table. If you use
only light or only dark mode, override the variable with the respective suffix:
-light
or-dark
.
See Styling article for more info.