Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage multiple skin of css with the same structure but different colors?

Tags:

css

sass

less

I need three skins that only have different colors
How can I create them so that the default file restructuring is applied automatically to other files?

<div class="test">
  Test
</div>

defaultVariables.scss:

$background: #f00;

default.scss:

@import "defaultVariables.scss";

.test{
    background: $background;
}

default.css:

.test{
    background: #f00;
}

darkVariables.scss:

$background: #000;

dark.scss:

@import "default.scss";
@import "darkVariables.scss";

dark.css: Expected output -> background: #000;

.test{
    background: #f00;
}

lightVariables.scss:

$background: #fff;

light.scss:

@import "default.scss";
@import "light.scss";

light.css: Expected output -> background: #fff;

.test{
    background: #f00;
}
like image 903
Mehdi Avatar asked Jan 29 '26 16:01

Mehdi


1 Answers

You must define _variable.scss and write all colors in this file:

//colors
$background:red;
$primary-color:#b22930;
$second-color:#dd4420;

//and then define again variables in dark mode for example:

body[data-theme="dark"]{
//colors
$background:#333;
$primary-color:#555;
$second-color:#888;
}

Or check this link: link for example

like image 134
Hossein Azizdokht Avatar answered Feb 01 '26 09:02

Hossein Azizdokht



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!