Skip to content

Palette Town API is a RESTful service that generates 5-color palettes based on various inputs like words or existing colors. It supports endpoints for random palettes, color-based queries and more.

Notifications You must be signed in to change notification settings

MattiasHenders/palette-town-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palette Town API Banner

Palette Town API

A RESTful API for generating appealing 5 colour, colour palettes.

Setup

Installation

# Download this project
git clone https://github.com/MattiasHenders/palette-town-api.git

Run

# Build and Run on MacOS/Linux
make run-server

# Build and Run on Windows
make run-server-windows

# API Endpoint : http://localhost:8080

Environment Variables

# Create .env in root, see .env.example for needed variables

API

Example Response JSON Structure

{
    "message": "Successfully got colour palette from given word",
    "givenInput": "forest",
    "code": 200,
    "data": {
        "colours": [
            "#747f41",
            "#538443",
            "#4f632d",
            "#8f995d",
            "#d4cc7d"
        ]
    },
    "coolorsLink": "https://coolors.co/747f41-538443-4f632d-8f995d-d4cc7d"
}

/api/colour/random

  • GET : Get a random colour palette

/api/colour/colours

  • GET : Get a colour palette based on an input of colours

/api/colour/words

  • GET : Get a colour palette based on an input of words

Example Palettes

Endpoint: /api/colour/random

image

Endpoint: /api/colour/colours
Input: colours=#fe34a1

image

Endpoint: /api/colour/words
Input: words=flame

image

Endpoint: /api/colour/words
Input: words=mango icecream

image

Todo

  • Support basic REST APIs.
  • Support Authentication with user for securing the APIs.
  • Write the tests for all APIs.
  • Organize the code with packages
  • Make docs with GoDoc
  • Building a deployment process
  • Connect to a database for users
  • Host the Colourminds API on own server
  • Allow for rgb inputs

Structure

├── src
│   ├── main.go
│   ├── handlers                    
│   │   ├── colours.go               // Common response functions for colour endpoints
│   │   └── users.go                 // Common response functions for user endpoints
│   ├── internal                    
│   │   ├── errors                  
|   │   │   └── errors.go            // Internal error models and functions
│   │   └── server_helpers          
|   │       └── server_helpers.go    // Internal error models and functions
│   ├── model
│   |   ├── colours.go               // Models for colours
│   |   ├── users.go                 // Models for users
│   |   └── server.go                // Models for the server
│   └── pkgs
│       └── colours.go               // Functions for generating colour palettes
├── config
│   └── config.go                    // Configuration
├── tests
│   └── colours                    
│       └── colours_test.go          // Tests for colour functions
└── main.go

Palette Town API Footer

About

Palette Town API is a RESTful service that generates 5-color palettes based on various inputs like words or existing colors. It supports endpoints for random palettes, color-based queries and more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages