Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save evandrocoan/a61770099f0b7f201b55599ab67684b1 to your computer and use it in GitHub Desktop.
Save evandrocoan/a61770099f0b7f201b55599ab67684b1 to your computer and use it in GitHub Desktop.
#
# Licensing
#
# Snippet
# Copyright (C) 2018 Evandro Coan <https://github.com/evandrocoan>
#
# OS ARQUIVOS NESTE REPOSITÓRIO SÃO FORNECIDOS "NO ESTADO EM QUE SE ENCONTRAM", SEM GARANTIA DE
# QUALQUER TIPO, EXPRESSA OU IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO ÀS GARANTIAS DE
# COMERCIALIZAÇÃO, APTIDÃO PARA UM PROPÓSITO ESPECÍFICO E NÃO INFRACÇÃO. EM NENHUMA CIRCUNSTÂNCIA, OS
# AUTORES OU TITULARES DE DIREITOS AUTORAIS SERÃO RESPONSÁVEIS POR QUALQUER RECLAMAÇÃO, DANOS OU OUTRA
# RESPONSABILIDADE, SEJA EM AÇÃO DE CONTRATO, DELITO OU DE OUTRA FORMA, DECORRENTE, DESTE OU
# RELACIONADO COM DOS ARQUIVOS DESTE REPOSITÓRIO OU O USO OU OUTRAS NEGOCIAÇÕES NO MODELO E SOFTWARE.
#
colors = [(0,0,0),
(255,255,255),
(255,0,0),
(0,255,0),
(0,0,255),
(255,255,0),
(0,255,255),
(255,0,255),
(192,192,192),
(128,128,128),
(128,0,0),
(128,128,0),
(0,128,0),
(128,0,128),
(0,128,128),
(0,0,128),]
def rule(x):
return 1 / 255 * x
def convert(colors):
new_colors = []
for r, g, b in colors:
new_colors.append( (rule(r), rule(g), rule(b)) )
return new_colors
print(convert(colors))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment