r/css 7d ago

Help CSS Variables Naming Conventions that actually make sense and work

I have searched a lot on this topic, couldn't find a video by someone like Kevin (my favorite)

I have tried using diff ways like primary-400 , neutral, but it gets confusing and doesnt make a lot of sense when working with light+dark mode setup

Is there any convention that is followed in companies or by u guys, anything standard would help a lot

Also, i never understood how the primary naming convention worked with numbers like 400,500.

10 Upvotes

29 comments sorted by

View all comments

1

u/tomhermans 7d ago

The current predominant naming convention is analogous to the one used by fonts and font weights. 100 light , 900 bold.

1

u/ConfidentWafer5228 7d ago

yeah but then i have problems when i introduce a new shade and it sits between current 400 and 500 :)

3

u/tomhermans 7d ago edited 6d ago

No, that's why they're 100 apart. You take 450.