Files
compiler-explorer/static/styles/colours.scss
T
Matt GodboltandClaude 506575bb3e SCSS Migration Phase 1: Modernize color functions and @import statements (#7970)
## Summary

**Phase 1 of systematic SCSS modernization** to prepare for Dart Sass
3.0.0 compatibility. This PR eliminates **all deprecated color function
warnings** and converts straightforward `@import` statements to modern
`@use` syntax.

## What This PR Accomplishes

### ✅ **All Color Function Deprecations Eliminated** (11 instances)
- `adjust-color()` → `color.adjust()` (5 instances in `colours.scss`)
- `lighten()` → `color.scale($lightness: +%)` (2 instances in
`dark-theme.scss`)
- `darken()` → `color.scale($lightness: -%)` (4 instances across themes)
- Added `@use 'sass:color'` imports to all theme files

### ✅ **@import to @use Conversion** (4 instances)
- Internal SCSS-to-SCSS imports converted to modern `@use` syntax
- `ansi-dark.scss` imports in theme files
- Custom golden layout theme imports
- All `@use` statements properly moved to top of files per SCSS
requirements

### ✅ **Zero Visual Changes**
- All themes render identically to before
- Extensive testing across all 4 themes (default, dark, pink, one-dark)
- Build process unchanged, functionality preserved

## Technical Approach

**5 incremental commits** with systematic validation at each step:
1. Add `@use 'sass:color'` imports (preparation)
2. Convert `colours.scss` color functions 
3. Convert `dark-theme.scss` color functions
4. Convert remaining theme color functions
5. Convert internal SCSS `@import` to `@use`

Each commit was individually tested for build success and visual
consistency.

## What This PR Does NOT Include

This is **Phase 1 only** - the following complex migrations are
intentionally deferred to **Phase 2**:

### 🔄 **Remaining for Phase 2: Architectural Changes**
- **Complex conditional theme system** in `explorer.scss` (lines
1157-1180)
  - Currently uses HTML attribute-based conditional `@import` statements
- Requires architectural redesign (CSS variables or separate entry
points)
- **CSS imports from node_modules** (FontAwesome, Golden Layout)
  - Kept as `@import` due to webpack compatibility requirements
- **Theme switching mechanism** updates if needed

### 📊 **Migration Progress**
- ✅ **Phase 1**: Color functions + simple imports (this PR)
- 🔄 **Phase 2**: Conditional theme system redesign  
- 🔄 **Phase 3**: Final cleanup and optimization

## Deprecation Warning Reduction

**Before this PR**: 45+ deprecation warnings
**After this PR**: ~15 deprecation warnings (only complex `@import`
statements remain)

All remaining warnings are the challenging conditional imports that
require Phase 2 architectural work.

## Testing

- ✅ Build succeeds: `npm run webpack`, `npm run ts-check`, `npm run
lint`
- ✅ All themes render correctly: default, dark, pink, one-dark
- ✅ No visual regressions or functional changes
- ✅ Theme switching works identically
- ✅ Form controls, scrollbars, and all UI elements maintain proper
styling

## Benefits

1. **Future-proofing**: Ready for Dart Sass 3.0.0 color function changes
2. **Maintainability**: Modern, namespaced color functions are clearer
3. **Performance**: Modern `@use` system loads modules once vs `@import`
duplication
4. **Incremental approach**: Safe, testable changes with easy rollback
if needed

## Follow-up Work

This establishes the foundation for **Phase 2**, which will tackle the
complex conditional theme system. The architectural decisions for Phase
2 can now be made independently without blocking this foundational
modernization.

Closes part of #7112

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-30 15:09:10 -05:00

294 lines
4.6 KiB
SCSS

@use 'sass:color';
/* These colours from Cynthia Brewer's excellent page at
* http://colorbrewer2.org/
*/
/* rainbow is 12 Set3 */
.rainbow-0 {
background: rgba(141, 211, 199, 0.35);
}
.rainbow-1 {
background: rgba(255, 255, 179, 0.35);
}
.rainbow-2 {
background: rgba(190, 186, 218, 0.35);
}
.rainbow-3 {
background: rgba(251, 128, 114, 0.35);
}
.rainbow-4 {
background: rgba(128, 177, 211, 0.35);
}
.rainbow-5 {
background: rgba(253, 180, 98, 0.35);
}
.rainbow-6 {
background: rgba(179, 222, 105, 0.35);
}
.rainbow-7 {
background: rgba(252, 205, 229, 0.35);
}
.rainbow-8 {
background: rgba(217, 217, 217, 0.35);
}
.rainbow-9 {
background: rgba(188, 128, 189, 0.35);
}
.rainbow-10 {
background: rgba(204, 234, 197, 0.35);
}
.rainbow-11 {
background: rgba(255, 237, 111, 0.35);
}
/* rainbow2 is 12 Paired */
.rainbow2-0 {
background: rgba(166, 206, 227, 0.35);
}
.rainbow2-1 {
background: rgba(31, 120, 180, 0.35);
}
.rainbow2-2 {
background: rgba(178, 223, 138, 0.35);
}
.rainbow2-3 {
background: rgba(51, 160, 44, 0.35);
}
.rainbow2-4 {
background: rgba(251, 154, 153, 0.35);
}
.rainbow2-5 {
background: rgba(227, 26, 28, 0.35);
}
.rainbow2-6 {
background: rgba(253, 191, 111, 0.35);
}
.rainbow2-7 {
background: rgba(255, 127, 0, 0.35);
}
.rainbow2-8 {
background: rgba(202, 178, 214, 0.35);
}
.rainbow2-9 {
background: rgba(106, 61, 154, 0.35);
}
.rainbow2-10 {
background: rgba(255, 255, 153, 0.35);
}
.rainbow2-11 {
background: rgba(177, 89, 40, 0.35);
}
/* earth is 'BrBG' */
.earth-0 {
background: rgba(140, 81, 10, 0.35);
}
.earth-1 {
background: rgba(191, 129, 45, 0.35);
}
.earth-2 {
background: rgba(223, 194, 125, 0.35);
}
.earth-3 {
background: rgba(246, 232, 195, 0.35);
}
.earth-4 {
background: rgba(245, 245, 245, 0.35);
}
.earth-5 {
background: rgba(199, 234, 229, 0.35);
}
.earth-6 {
background: rgba(128, 205, 193, 0.35);
}
.earth-7 {
background: rgba(53, 151, 143, 0.35);
}
.earth-8 {
background: rgba(1, 102, 94, 0.35);
}
/* Greens and blues is Paired */
.green-blue-0 {
background: rgba(166, 206, 227, 0.35);
}
.green-blue-1 {
background: rgba(31, 120, 180, 0.35);
}
.green-blue-2 {
background: rgba(178, 223, 138, 0.35);
}
.green-blue-3 {
background: rgba(51, 160, 44, 0.35);
}
/* Gray shades */
.gray-shade-0 {
background: rgba(190, 190, 190, 0.15);
}
.gray-shade-1 {
background: rgba(150, 150, 150, 0.15);
}
.gray-shade-2 {
background: rgba(110, 110, 110, 0.15);
}
.gray-shade-3 {
background: rgba(70, 70, 70, 0.15);
}
/*rainbow dark*/
.rainbow-dark-0 {
background: rgba(40, 83, 76, 0.35);
}
.rainbow-dark-1 {
background: rgba(102, 102, 29, 0.35);
}
.rainbow-dark-2 {
background: rgba(38, 28, 104, 0.35);
}
.rainbow-dark-3 {
background: rgba(75, 18, 11, 0.35);
}
.rainbow-dark-4 {
background: rgba(30, 71, 100, 0.35);
}
.rainbow-dark-5 {
background: rgba(110, 65, 13, 0.35);
}
.rainbow-dark-6 {
background: rgba(48, 75, 3, 0.35);
}
.rainbow-dark-7 {
background: rgba(109, 6, 59, 0.35);
}
.rainbow-dark-8 {
background: rgba(66, 47, 47, 0.35);
}
.rainbow-dark-9 {
background: rgba(53, 8, 54, 0.35);
}
.rainbow-dark-10 {
background: rgba(24, 97, 8, 0.35);
}
.rainbow-dark-11 {
background: rgba(105, 94, 7, 0.35);
}
/*soft rainbow dark*/
.soft-rainbow-dark-0 {
background: rgba(79, 140, 135, 0.15);
}
.soft-rainbow-dark-1 {
background: rgba(160, 160, 49, 0.15);
}
.soft-rainbow-dark-2 {
background: rgba(80, 80, 183, 0.15);
}
.soft-rainbow-dark-3 {
background: rgba(162, 50, 24, 0.15);
}
.soft-rainbow-dark-4 {
background: rgba(51, 122, 173, 0.15);
}
.soft-rainbow-dark-5 {
background: rgba(186, 136, 23, 0.15);
}
.soft-rainbow-dark-6 {
background: rgba(125, 178, 70, 0.15);
}
.soft-rainbow-dark-7 {
background: rgba(165, 60, 109, 0.15);
}
.soft-rainbow-dark-8 {
background: rgba(125, 88, 88, 0.15);
}
.soft-rainbow-dark-9 {
background: rgba(120, 42, 151, 0.15);
}
.soft-rainbow-dark-10 {
background: rgba(47, 120, 35, 0.15);
}
/* Gray shades */
/*@for $i from 0 through 4 {
.pink- hashtag {$i} {
background: color.scale(#fae1fa, $lightness: -(($i + 1) * 2%));
}
}*/
.pink-0 {
background: color.adjust(#f9d8f9, $alpha: -0.35);
}
.pink-1 {
background: color.adjust(#f7d0f7, $alpha: -0.35);
}
.pink-2 {
background: color.adjust(#f6c7f6, $alpha: -0.35);
}
.pink-3 {
background: color.adjust(#f4bef4, $alpha: -0.35);
}
.pink-4 {
background: color.adjust(#f3b5f3, $alpha: -0.35);
}