Skip to content

Conversation

@Charmiseera
Copy link
Contributor

@Charmiseera Charmiseera commented Sep 20, 2025

feat: centralize color management - replace scattered hardcoded colors with ColorConstants class across 11 files

What kind of change does this PR introduce?

Feature/Refactoring - This PR introduces a centralized color management system to improve code maintainability and consistency.

Issue Number:

Fixes #85

Snapshots/ video:

screen-capture.mp4
  • ✅ Build Status: flutter build web - Successful
  • ✅ Runtime Status: flutter run -d chrome - Working
  • ✅ No Breaking Changes: All existing functionality preserved
  • ✅ Code Quality: All lint issues resolved

Summary

This PR addresses the issue of scattered hardcoded color values throughout the codebase by implementing a comprehensive centralized color management system.

Problems Solved:

  • Eliminated 20+ scattered Color(0xFFxxxxxx) hardcoded values
  • Fixed Colors.grey[shade] const evaluation errors
  • Improved code maintainability and consistency
  • Established single source of truth for all application colors

Key Changes:

  • New: color_constants.dart - Central color definitions with 33 organized constants
  • Updated: 11 existing files to use centralized color references
  • Categories: 6 functional color groups (Background, Snackbar, UI, Highlight, Dialog, App-specific)
  • Documentation: Added comprehensive CONTRIBUTION_SUMMARY.md
  • Fixes: highlightColors now fully const-compatible, checkIconWhite color centralized, gray color references made semantic

Files Modified:

  • color_constants.dart (new & improved)
  • canvas_state.dart & lib/cubit/canvas_cubit.dart
  • lib/ui/widgets/ - 5 widget files updated
  • lib/ui/screens/ - 3 screen files updated
  • custom_snackbar.dart
  • CONTRIBUTION_SUMMARY.md (new)
  • pubspec.lock, pubspec.yaml (dependency upgrades for lockfile update)

Does this PR introduce a breaking change?

No - This PR does not introduce any breaking changes. All existing functionality is preserved while improving the underlying code organization. The changes are purely internal refactoring with no API or behavior modifications.

Other information

Benefits:

  • Maintainability: Easy color scheme updates in single file
  • Performance: Compile-time const optimizations
  • Consistency: Standardized color usage across all components
  • Developer Experience: Clear color naming and documentation
  • Future-Ready: Simplified theme customization and updates

Technical Details:

  • All colors are static const for compile-time optimization
  • Semantic naming convention (purpose-based, not appearance-based)
  • Comprehensive inline documentation
  • Helper methods for common color operations
  • Backward compatible with existing Material Design colors

Have you read the contributing guide , README.md , code of conduct?

Yes - All contribution guidelines, project documentation, and code of conduct have been reviewed and followed.

@github-actions
Copy link
Contributor

Our Pull Request Approval Process

Thanks for contributing!

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

Other

🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Congratulations on making your first PR! If you haven't already, check out our Contributing Guidelines and README to ensure that you are following our guidelines for contributing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason for this removal? if not then please add it back.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pubspec.yaml Outdated
color: "#ffffff"
image: assets/icons/whitebg.png

# Color centralization improvements implemented
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@may-tas
Copy link
Owner

may-tas commented Sep 21, 2025

@Charmiseera Kindly upload a screen recording as proof of work.
To verify if the colors in the user interface are consistent.

@Charmiseera
Copy link
Contributor Author

@Charmiseera Kindly upload a screen recording as proof of work. To verify if the colors in the user interface are consistent.

Sure

@may-tas
Copy link
Owner

may-tas commented Sep 22, 2025

@Charmiseera updates?

@Charmiseera
Copy link
Contributor Author

I will update code as you suggested and upload working proof by today night.

@may-tas
Copy link
Owner

may-tas commented Sep 22, 2025

Alright.

@Charmiseera
Copy link
Contributor Author

Alright.

Hey @may-tas , I have updated the code and also uploaded the screen recording as working proof.

@may-tas
Copy link
Owner

may-tas commented Sep 24, 2025

@Charmiseera
Great work! Centralising the colours will improve code quality and stability.

@may-tas may-tas merged commit fe8510c into may-tas:main Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gssoc25 level2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamline Color Management by Using a ColorConstants Class

2 participants