Recently, I decided to create an enum that holds some commonly used colors throughout my application.
export enum SeverityColor {
None = '#2196F3',
Low = '#39B54a',
Medium = '#FCEE21',
High = '#F7931E',
Critical = '#F44336',
}
Now, the team is exploring adding a theme switch feature - transitioning between dark and light modes. In order to achieve this, the colors defined in the enum must dynamically update based on the active mode. While it may not be considered best practice, I am wondering if there is a way to update this Enum conditionally rather than manually modifying each reference in the codebase.
If anyone has any suggestions or alternative approaches to tackle this challenge, I would greatly appreciate your input. Thank you!