Streamlit component for color selection with support for solid colors and gradients
Project description
Color Selector
Um componente Streamlit para seleção de cores com suporte a cores sólidas e gradientes lineares.
Instalação
pip install color-selector
Como usar
import streamlit as st
from color_selector import color_selector
# Lista de cores disponíveis (cores sólidas e gradientes)
colors = [
{"name": "Vermelho", "color": "#FF0000"},
{"name": "Azul", "color": "#0000FF"},
{"name": "Verde", "color": "#00FF00"},
{"name": "Gradiente Azul-Verde", "color": ["#0000FF", "#00FF00"]},
{"name": "Gradiente Vermelho-Amarelo", "color": ["#FF0000", "#FFFF00"]},
{"name": "Gradiente Arco-íris", "color": ["#FF0000", "#00FF00", "#0000FF"]}
]
# Usar o componente
selected_color = color_selector(colors=colors, key="color_picker")
st.write(f"Cor selecionada: {selected_color}")
Funcionalidades
- Seleção visual de cores com bolinhas coloridas
- Suporte a cores sólidas (hex, rgb, hsl)
- Suporte a gradientes lineares (lista de cores)
- Layout responsivo e minimalista
- Interface limpa sem títulos ou informações extras
- Integração perfeita com Streamlit
Formato das Cores
Cores Sólidas
{"name": "Nome da Cor", "color": "#FF0000"}
Gradientes Lineares
{"name": "Nome do Gradiente", "color": ["#FF0000", "#00FF00"]}
Desenvolvimento
Para executar em modo de desenvolvimento:
cd template_copy/color_selector/frontend
npm install
npm run start
Em outro terminal:
streamlit run template_copy/example.py
Exemplo Completo
import streamlit as st
from color_selector import color_selector
st.title("Seletor de Cores")
# Exemplos de cores
colors = [
{"name": "Vermelho", "color": "#FF0000"},
{"name": "Azul", "color": "#0000FF"},
{"name": "Verde", "color": "#00FF00"},
{"name": "Amarelo", "color": "#FFFF00"},
{"name": "Roxo", "color": "#800080"},
{"name": "Laranja", "color": "#FFA500"},
{"name": "Gradiente Azul-Verde", "color": ["#0000FF", "#00FF00"]},
{"name": "Gradiente Vermelho-Amarelo", "color": ["#FF0000", "#FFFF00"]},
{"name": "Gradiente Arco-íris", "color": ["#FF0000", "#00FF00", "#0000FF"]}
]
# Usar o componente
selected_color = color_selector(colors=colors, key="color_picker")
if selected_color:
st.write(f"**Cor selecionada:** {selected_color['name']}")
st.write(f"**Valor:** {selected_color['color']}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
color_selector-0.1.0.tar.gz
(60.3 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file color_selector-0.1.0.tar.gz.
File metadata
- Download URL: color_selector-0.1.0.tar.gz
- Upload date:
- Size: 60.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c045867635266d819d0f2d30c6cc5557c271931ac0ee928c74627213ef789e0c
|
|
| MD5 |
2f88736ab0d003c1f8ff8a6e5cec6316
|
|
| BLAKE2b-256 |
5dde32c6da4ce2bd7c715f1ba8c5433a70cfe0c3155fc25fc39e218a3157e3d0
|
File details
Details for the file color_selector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: color_selector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 170.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b9e38cd11f6a3fda865304337510bfb10e533728073dffaf8f30331f511b1c2
|
|
| MD5 |
9805d563a32a5689a2c497a33358de53
|
|
| BLAKE2b-256 |
191091d173b5e44cf45fa7dfdf78baa8727dfe8dd4df76e55799e292aca13872
|