Documentation
Our WebsiteOur Github
  • 👋Welcome to Infinitode Documentation
  • AI Documentation
  • API Documentation
    • Basic Math API Documentation (#Experimental)
    • BMI Calculator API Documentation
    • Character Counter API Documentation
    • Chemical Equation Balancer API Documentation
    • Color Generator API Documentation
    • Date Difference Calculator API Documentation
    • Dungen API Documentation
    • Dungen Dev API Documentation
    • Factorial Calculator API Documentation
    • Fantasy Name Generator API Documentation
    • Fibonacci Sequence Generator API Documentation
    • GCD Calculator API Documentation
    • Hash API Documentation
    • Helix PSA API Documentation
    • LCM Calculator API Documentation
    • Leap Year Checker API Documentation
    • Lorem API Documentation
    • Molar Mass Calculator API Documentation (#Experimental)
    • MycoNom API Documentation
    • Name Generator API Documentation
    • Palindrome Checker API Documentation
    • Password Generator API Documentation
    • Password Strength Detector API Documentation
    • Periodic Table API Documentation
    • Prime Number Checker API Documentation
    • Quadratic Equation Solver API Documentation
    • Random Facts Generator API Documentation
    • Random Quotes Generator API Documentation
    • Roman Numeral Converter API Documentation
    • Simple Interest Calculator API Documentation
    • Slugify API Documentation
    • Text Case Converter API Documentation
    • Unit Converter API Documentation
    • Username Generator API Documentation
    • UUID Generator API Documentation
    • Vowel Counter API Documentation
  • Package Documentation
    • BlurJS Package Documentation
      • BlurJS Usage Examples
      • BlurJS Reference Documentation
    • CodeSafe Package Documentation
      • CodeSafe Reference
        • CodeSafe Functions
    • DeepDefend Package Documentation
      • DeepDefend Reference
        • Attacks Functions
        • Defenses Functions
    • DupliPy Package Documentation
      • DupliPy Reference
        • Formatting Functions
        • Replication Functions
        • Similarity Functions
        • Text Analysis Functions
    • FuncProfiler Package Documentation
      • FuncProfiler Reference
        • FuncProfiler Functions
    • Hued Package Documentation
      • Hued Reference
        • Analysis Functions
        • Colors Functions
        • Conversions Functions
        • Palettes Functions
    • LocalSiteMap Package Documentation
      • LocalSiteMap Reference
        • LocalSiteMap Functions
    • PyAutoPlot Package Documentation
      • PyAutoPlot Reference
        • PyAutoPlot Functions
    • PyWebScrapr Package Documentation
      • PyWebScrapr Reference
        • PyWebScrapr Functions
    • ValX Package Documentation
      • ValX Reference
        • ValX Functions
Powered by GitBook
On this page
  • Generate complementary
  • Generate analogous
  • Generate triadic
  • Generate tetradic
  • Generate square
  • Generate split-complementary
  • Generate monochromatic
  • Palette to HEX
  • Generate random palette
  • Generate random color
  • Generate random HEX colors
  • Generate gradient
  • Export palette

Was this helpful?

  1. Package Documentation
  2. Hued Package Documentation
  3. Hued Reference

Palettes Functions

PreviousConversions FunctionsNextLocalSiteMap Package Documentation

Last updated 1 month ago

Was this helpful?

Available functions:

  • ColorPalette.__init__(base_color): Initializes the color palette with a base color.

  • ColorPalette.(): Generates a complementary color palette.

  • ColorPalette.(angle=30): Generates an analogous color palette.

  • ColorPalette.(): Generates a triadic color palette.

  • ColorPalette.(): Generates a tetradic color palette.

  • ColorPalette.(): Generates a square color palette.

  • ColorPalette.(): Generates a split-complementary color palette.

  • ColorPalette.(shades=24): Generates a monochromatic color palette with varying lightness.

  • ColorPalette.(): Converts the RGB palette to HEX format.

  • ColorPalette.(): Generates a random base color and its associated palettes.

  • ColorPalette.(): Generates a random RGB color and converts it to HEX and HSL formats.

  • ColorPalette.(n=10): Generates a list of random colors in HEX format.

  • ColorPalette.(color1, color2, steps=10): Generates a gradient between two RGB colors.

  • ColorPalette.(filename="palette.json"): Exports the current color palette (list or dict) to a file.

To use ColorPalette, you must first initialize it with a base color (RGB tuple) before use:

color_manager = ColorManager(base_color)

This, however, is not needed when using for random generation; you can init with a default RGB color of (0,0,0), which is black.


Generate complementary

Generates a complementary color palette.

Returns:
    list: A list of RGB tuples representing the complementary palette.

Generate analogous

Generates an analogous color palette.

Parameters:
    angle (int): The angle difference for analogous colors (default 30).

Returns:
    list: A list of RGB tuples representing the analogous palette.

angle represents how close the color values are to each other. You can lower the angle to, say 15, for closer colors to that of the base color, or even increase it for colors that are still analogous in a sense but further away.

Generate triadic

Generates a triadic color palette.

Returns:
    list: A list of RGB tuples representing the triadic palette.

Generate tetradic

Generates a tetradic color palette.

Returns:
    list: A list of RGB tuples representing the tetradic palette.

Generate square

Generates a square color palette.

Returns:
    list: A list of RGB tuples representing the square palette.

Generate split-complementary

Generates a split-complementary color palette.

Returns:
    list: A list of RGB tuples representing the split-complementary palette.

Generate monochromatic

Generates a monochromatic color palette.

Parameters:
    shades (int): Number of shades to generate (default 24).

Returns:
    list: A list of RGB tuples representing the monochromatic palette.

Palette to HEX

Converts the RGB palette to HEX format.

Returns:
    list: A list of HEX strings representing the palette.

Generate random palette

Generates a random base color and its associated palettes.

Returns:
    dict: A dictionary containing the following keys:
        - 'Base Color' (tuple): The randomly generated RGB base color, e.g., (R, G, B).
        - 'Complementary Palette' (list): A list of colors in the complementary palette.
        - 'Analogous Palette' (list): A list of colors in the analogous palette.
        - 'Triadic Palette' (list): A list of colors in the triadic palette.
        - 'Monochromatic Palette' (list): A list of colors in the monochromatic palette.

Generate random color

Generates a random RGB color and converts it to HEX and HSL formats.

Returns:
    dict: A dictionary containing:
        - "RGB Color" (tuple): The random RGB color as a tuple of three integers.
        - "HEX Color" (str): The color converted into HEX format.
        - "HSL Color" (tuple): The color converted into HSL format.

Generate random HEX colors

Generates a list of random colors in HEX format.

Parameters:
    n (int, optional): The number of random HEX colors to generate. Default is 10.

Returns:
    list: A list of HEX color strings.

We chose to add a batch HEX color generate function just for accessibility since HEX is popular, but you can quickly convert the colors to other formats as well.

Generate gradient

Generates a gradient between two RGB colors.

Parameters:
    color1 (tuple): The starting RGB color (0-255).
    color2 (tuple): The ending RGB color (0-255).
    steps (int): The number of intermediate steps in the gradient (total colors = steps + 1).

Returns:
    list: A list of RGB tuples representing the gradient. Does NOT modify self.palette.

Export palette

Exports the current color palette (list or dict) to a file.

Supported formats: .json, .txt, .csv.

    - JSON: Exports the full structure, converting RGB tuples to {"rgb": (r,g,b), "hex": "#RRGGBB"} objects for clarity.
    - TXT:  Exports a human-readable text format, labeling each palette type if the source is a dictionary.
    - CSV:  Exports a flattened structure. For lists: Type, Index, Hex, R, G, B. For dicts: PaletteName, Index, Hex, R, G, B

Parameters:
    filename (str): The name of the file to save the palette. The extension determines the format (.json, .txt, .csv). Defaults to "palette.json".

Raises:
    ValueError: If the filename has an unsupported extension or if the palette is empty or in an unexpected format.
    TypeError: If self.palette is not a list or dict.
generate_complementary
generate_analogous
generate_triadic
generate_tetradic
generate_square
generate_split_complementary
generate_monochromatic
palette_to_hex
generate_random_palette
generate_random_color
generate_random_hex_colors
generate_gradient
export_palette