How sass formulates different styles of skin according to a certain parameter.

problem description

sass formulates different styles of skin according to a certain parameter, how to write css in this case?

the environmental background of the problems and what methods you have tried

Environment: sass,vue.
A company project is a set of code that outputs multiple products, determines the product by the fields returned in the background, and then loads different styles. The difference between products lies in their style and color (skin).

the previous method was to set an id for the outermost div of each product, and then add a css for each product through the nesting feature of the sass. This results in assigning and pasting a large piece of common css code for each product added. So I would like to ask if there is a better way to ask for help!

related codes

/ / Please paste the code text below (do not replace the code with pictures)

html is simplified to display different color styles based on the fields returned in the background.

//1 -> skin 1
<div id="app">
    <div id="skin-1">
        1
    </div>  
</div>
//2 -> skin 2
<div id="app">
    <div id="skin-2">
        1
    </div>  
</div>
//sass

//
$color-1:red;
$color-2:green;

-sharpapp{
    & -sharpskin-1{
        background-color:$color-1;
    }
    & -sharpskin-2{
        background-color:$color-2;
    }
}

what result do you expect? What is the error message actually seen?

I would like to ask if there is another way? A rookie who just started the profession is not very good at it.

Jun.28,2022

skin name A-> one set of css settings-one set of structure
skin name B-> one set of css settings-one set of structure

where the name only needs to be changed. Follow this line of thinking. For a product, of course.


@mixin bg_color(){
  background-color: -sharp3f8e4d;//
  [data-theme="theme1"] & {
    background-color: red;
    color: white;
    font-size: 50px;
  }
  [data-theme="theme2"] & {
    background-color: yellow;
    color: black;
    font-size: 40px;
  }
  [data-theme="theme3"] & {
    background-color: black;
    color: red;
    font-size: 20px;
  }
}

change the currently selected topic according to data-theme
window.document.documentElement.setAttribute ('data-theme', theme)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9fcad-2f4b7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9fcad-2f4b7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?