-
Notifications
You must be signed in to change notification settings - Fork 0
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
Proposal for a Plugin System to Extend Colorus-js Functionality #16
Comments
Hey everyone, I've been working on a refined approach for implementing the plugin system in Colorus-js. Here's a summary of the key features of this new design: Key Features:
Example: const color = new Colorus('rgb(20 120 80)').use(colorInstance => ({
getHue: () => colorInstance.hsl.h
}))
console.log(color.getHue()) // Return: 156
console.log(color.darken(0.1).toHex()) // Return: '#126C48' I'd love to get your feedback on this approach! Do you think it provides a clean and flexible way to extend Colorus-js functionality? Are there any specific use cases or challenges you envision that this approach might need to address? Feel free to share your thoughts and suggestions below. |
Here's another idea for how we could implement the plugin system in Colorus-js that I'd love to get your thoughts on: Alternative Approach: Constructor-Based Configuration Instead of having a separate
Example: const color = new Colorus('rgb(20 120 80)', {
plugins: [
colorInstance => ({
getHue: () => colorInstance.hsl.h
})
]
})
console.log(color.getHue()) // Returns: 156
console.log(color.darken(0.1).toHex()) // Returns: '#126C48' Potential Benefits:
Considerations:
Feedback: I'm curious to hear your thoughts on this alternative approach! Would this be a more user-friendly way to implement plugins in Colorus-js? Do you see any potential drawbacks or challenges we should be aware of? Your feedback would be greatly appreciated! |
After considering different approaches, I'm leaning toward this plugin system design: const color = new Colorus('rgb(20, 120, 80)', {
plugins: {
getHue: function() { return this.hsl.h },
// ... other plugin methods
}
}); Why I Think This Design is Best
Comparison to Other Approaches
Caveats:
Next Steps: With this design in mind, I'd like to move forward with implementation and error handling. I'd appreciate any feedback or suggestions you might have on this approach before I start coding. Let me know what you think! |
Description:
As Colorus-js continues to grow, I believe it's time to explore the addition of a plugin system. This would allow users to extend the core functionality of the library with their own custom features, color spaces, and color manipulation algorithms.
Motivation:
Proposed Goals:
Possible Challenges:
Next Steps:
Call to Action:
I invite everyone to share their thoughts and ideas on this proposal. Please comment below with your feedback, suggestions, or interest in contributing to this project.
The text was updated successfully, but these errors were encountered: