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

Algorithmic Themes #7

Open
gnomical opened this issue Feb 19, 2024 · 1 comment
Open

Algorithmic Themes #7

gnomical opened this issue Feb 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@gnomical
Copy link
Owner

gnomical commented Feb 19, 2024

Description

To enhance the theming capabilities of the solid-theme-provider, it's proposed to introduce a sophisticated algorithmic theme generation feature, drawing inspiration from Material Design 3's color system. This new feature aims to elevate the current simplistic and naive approach to a more robust and dynamic system that can generate comprehensive themes based on one or more source colors.

The current implementation, as outlined in special considerations for color and the calculate variants prop, provides a foundational layer. However, to achieve more adaptive, aesthetically pleasing, and efficient color schemes, a more advanced algorithm is required.

Design Considerations

The primary goal is to ensure that any theme generated by this feature is not only aesthetically pleasing but also maintains backward compatibility. As such, the system should:

  • Generate themes dynamically based on input colors, adjusting hues, saturation, and lightness to create a balanced and harmonious palette.
  • Include a set of predefined color roles for UI elements (e.g., background, foreground, container, button, error states) ensuring sufficient contrast and readability according to WCAG guidelines.
  • Allow for the future introduction of additional color roles or adjustments without breaking existing themes.

Implementation Steps

  1. Algorithm Development: Develop a JavaScript algorithm to include dynamic generation of complementary and contrasting colors, ensuring accessibility standards are met for text and background contrast ratios.
  2. Integration: Embed the algorithm within the solid-theme-provider, allowing users to input one or more seed colors to generate a theme dynamically.
  3. Demo Site Creation: Develop a demo site that visually represents the generated theme based on user-input seed colors. This site should allow users to tweak colors and see the effects in real-time, providing an intuitive interface for theme customization.
  4. Export Functionality: Implement a feature to export the generated theme as a themes.json file, serving both as a reference for available CSS variables and as a tool for preserving theme versions.

Future Enhancements

  • Theme Customization: Introduce advanced options for users to fine-tune generated themes, including adjusting color contrasts, adding custom color roles, and modifying saturation or lightness for specific UI elements.
  • Documentation and Tutorials: Provide comprehensive documentation and tutorials on using the theme generation feature, including best practices for selecting seed colors and integrating the generated themes into projects.

Conclusion

This feature represents a significant enhancement to the solid-theme-provider, promising to deliver a dynamic and user-friendly approach to theme generation that is both aesthetically pleasing and accessible. By drawing inspiration from established design systems and focusing on adaptability and backward compatibility, we can ensure that this feature remains valuable for a wide range of applications and user needs.

@gnomical gnomical added the enhancement New feature or request label Feb 19, 2024
@gnomical
Copy link
Owner Author

possible color manipulation libraries

  • Tiny Color
    lighten is broken into increments of 1 percent, however this is relative to the entire spectrum, not just the colors difference from white.
  • Chroma.js
    lighten is divided into 1/18th of the whole spectrum but allows passing in floats for partial increments.
  • Color
    lighten is a percent of the color's current luminance. E.g. 50% luminance with a lighten(0.5) results in 75% luminance - a 50% increase of its initial value.

additional libraries

  • Color Thief
    allow pulling a palette from an image
  • Please.js
    generates random color schemes or a scheme based on a seed color

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

No branches or pull requests

1 participant