This project demonstrates a reusable color palette system implemented in React. The CustomColorPalette
provides customizable color sets and a utility function for applying opacity to colors. The CustomColorPaletteSample
component showcases how to use this palette in a UI.
Our project will consist of:
Two different Lottie animations.
Let's dive into the implementation!
CustomColorPalette
This module defines:
applyOpacity(hexCode, opacity)
: Converts a HEX color to RGBA with the specified opacity.CustomColorSets
: An object containing all predefined color sets.CustomColorFontColor
: A mapping of color modes to recommended font colors for contrast.CustomColorPaletteSample
A demonstration component that:
CustomColorPalette
.import React from "react";
import CustomColorPaletteSample from "./CustomColorPaletteSample";
function App() {
return (
<div>
<h1>Custom Color Palette Demo</h1>
<CustomColorPaletteSample />
</div>
);
}
export default App;
The application displays: