This free Google Sheet script uses GPT-3 AI to generate a colour palette based on any English description.
This script demonstrates the flexibility of OpenAI’s machine learning language model. In this example, colour is treated as a form of language in response to any provided prompt.
You simply type a request into a cell, the script then produces a relevant colour palette with GPT-3 and displays it in the corresponding cells with their hex code values.
If you are lacking inspiration, here are a few example prompts:
The script is designed to produce a complementary colour palette based on any prompt you provide. Therefore, a prompt of e.g. “shades of blue” won’t necessarily produce only shades of blue as a response. It will also generate palette variations if the same prompt is re-used.
It’s important to understand that GPT-3 is not simply querying a database of known facts or using Google’s search index.
GPT-3 was trained with data from CommonCrawl, WebText, Wikipedia, and a large corpus of books. It extracts data from multiple sources instantly and combine them to assemble your request. The model was trained until the end of 2019. For example, it knows a great deal about Coronaviruses but nothing about Covid-19.
Even more impressive is the degree to which it can understand your query even when your language is imprecise. It will make an educated guess as to the results you are likely to want, even when they have not been explicitly stated.
1) The first step is to register a free account at OpenAI.com
Upon registration, you will be given $18 worth of free API credits.
Once registered, grab a copy of your secret API key and save it on your device.
2) Download a copy of my free Google Sheet and script designed to make this process as easy as possible without having to understand or write any code.
3) Enter your API Key from Step 1 in Cell A2 of the “Settings” sheet.
4) Enter a prompt for the palette you require into Cell A2 of the “Palette” sheet. For example, “Mediterranean sky”
5) Click on “GET PALETTE” from the main menu.
You may be asked to grant the script permission if this is your first attempt.
6) After a short delay, you should see the palette appear with the hex code values for each colour.
Do take a look at the script behind this function by selecting Extensions > Apps Script from the main menu and feel free to adapt it for different use cases.
I am interested to hear about any interesting palettes you create with this script. Please let me know how you get on.