Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Sort css classes #1500

Open
disconcision opened this issue Feb 6, 2025 · 0 comments
Open

Clean up Sort css classes #1500

disconcision opened this issue Feb 6, 2025 · 0 comments
Labels

Comments

@disconcision
Copy link
Member

Now that I understand how css variable scoping works, we should be able to drastically simplify the css side of adding a new sort. Specifically, css variables declared within rules apply to all other rules matching the original rule's selector.

As long as we follow the logic of, when a page element should take on some sort-dependent color accent, we put the class Sort.to_string(sort) on it, then we should be able to just specify a single css rule:

.Typ {
  --sort-main #234323;
  --sort-accent: #59af3e;
}

then, all component-specific rules involving that sort could just refer to that variable, so instead of having a bunch of rules like:

#cursor-inspector .Exp .gamma {
  background-color: var(--token-exp);
}
#cursor-inspector .Pat .gamma {
  background-color: var(--token-pat);
}
#cursor-inspector .Typ .gamma {
  background-color: var(--token-typ);
}

we could have a single rule like:

#cursor-inspector .Exp .gamma {
  background-color: var(--sort-main);
}

This approach would eliminate whole pages of rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant