Skip to content

Commit

Permalink
Added Latex colormap for 2021 colors
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuederle committed Jan 23, 2023
1 parent f962253 commit fc2e046
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 15 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ We support the old colors based on the

## Download the colors

### Gimp/Inkscape
If you just need the colors outside Python, you can download a GIMP colorpalette with all colors (see image below).
Right click any of the links below and then select "Save Link as":

<a href="https://raw.githubusercontent.com/mad-lab-fau/fau_colors/main/color_palettes/fau_colors_2019.gpl" download>2019 colors</a>
<a href="https://raw.githubusercontent.com/mad-lab-fau/fau_colors/main/color_palettes/fau_colors_2021.gpl" download>2021 colors</a>

These files can be imported into GIMP or Inkscape.

### Latex

We also provide a LaTeX color file for the 2021 colors. You can download it here:

<a href="https://raw.githubusercontent.com/mad-lab-fau/fau_colors/main/color_palettes/fau_colors_2021.tex" download>2021 colors</a>

For this to work you need to include the xcolor package in your preamble (`\usepackage{xcolor}`) and then you can use
the colors by copying the file into your project and including it in your document (`\input{fau_colors_2021.tex}`).

If you need the colors in other formats, please open an issue with details about the required file format.

## Installation
Expand Down
6 changes: 5 additions & 1 deletion color_palettes/_create_palettes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from pathlib import Path

from fau_colors import export_as_gpl
from fau_colors import export_as_gpl, export_as_tex
from fau_colors.v2019 import cmaps as colors_2019
from fau_colors.v2021 import cmaps as colors_2021
from fau_colors.v2021 import cmaps_with_names as colors_2021_with_names

HERE = Path(__file__).parent

export_as_gpl(colors_2021, file_name="fau_colors_2021.gpl", folder_path=HERE)
export_as_gpl(colors_2019, file_name="fau_colors_2019.gpl", folder_path=HERE)


export_as_tex(colors_2021_with_names, file_name="fau_colors_2021.tex", folder_path=HERE)
104 changes: 104 additions & 0 deletions color_palettes/fau_colors_2021.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
% Tex color file defining the FAU colors.
% To use, you need to include the `xcolor` package (\usepackage{xcolor} in your preamble).
% Then copy this file into your project and include it with `\input{fau_colors_2021.tex}`.\definecolor{fau-fau-125}{rgb}{0.8745098039215686, 0.8976393694732795, 0.9276585928489043}
\definecolor{fau-fau-250}{rgb}{0.7490196078431373, 0.795278738946559, 0.8553171856978086}
\definecolor{fau-fau-375}{rgb}{0.6235294117647059, 0.6929181084198386, 0.7829757785467129}
\definecolor{fau-fau-625}{rgb}{0.37254901960784315, 0.48819684736639757, 0.6382929642445214}
\definecolor{fau-fau-dark}{rgb}{0.01568627450980392, 0.11764705882352941, 0.25882352941176473}
\definecolor{fau-fau-light}{rgb}{0.37254901960784315, 0.48627450980392156, 0.6392156862745098}
\definecolor{fau-fau_dark-125}{rgb}{0.876478277585544, 0.889273356401384, 0.9069896193771626}
\definecolor{fau-fau_dark-250}{rgb}{0.7529565551710881, 0.7785467128027682, 0.8139792387543252}
\definecolor{fau-fau_dark-375}{rgb}{0.629434832756632, 0.6678200692041523, 0.7209688581314879}
\definecolor{fau-fau_dark-625}{rgb}{0.3823913879277201, 0.4463667820069205, 0.5349480968858131}
\definecolor{fau-fau_dark}{rgb}{0.01568627450980392, 0.11764705882352941, 0.25882352941176473}
\definecolor{fau-fau_light-125}{rgb}{0.9212610534409842, 0.9355324875048059, 0.954725105728566}
\definecolor{fau-fau_light-250}{rgb}{0.8425221068819685, 0.8710649750096117, 0.9094502114571319}
\definecolor{fau-fau_light-375}{rgb}{0.7637831603229527, 0.8065974625144176, 0.8641753171856978}
\definecolor{fau-fau_light-625}{rgb}{0.6063052672049212, 0.6776624375240292, 0.7736255286428296}
\definecolor{fau-fau_light}{rgb}{0.37254901960784315, 0.48627450980392156, 0.6392156862745098}
\definecolor{fau-fau}{rgb}{0.0, 0.1843137254901961, 0.4235294117647059}
\definecolor{fau-med-125}{rgb}{0.8745098039215686, 0.954725105728566, 0.9847443291041907}
\definecolor{fau-med-250}{rgb}{0.7490196078431373, 0.9094502114571319, 0.9694886582083814}
\definecolor{fau-med-375}{rgb}{0.6235294117647059, 0.8641753171856978, 0.9542329873125721}
\definecolor{fau-med-625}{rgb}{0.37254901960784315, 0.7736255286428296, 0.9237216455209535}
\definecolor{fau-med-dark}{rgb}{0.0, 0.3803921568627451, 0.6274509803921569}
\definecolor{fau-med-light}{rgb}{0.37254901960784315, 0.7725490196078432, 0.9254901960784314}
\definecolor{fau-med_dark-125}{rgb}{0.8745098039215686, 0.922245290272972, 0.9532487504805844}
\definecolor{fau-med_dark-250}{rgb}{0.7490196078431373, 0.8444905805459438, 0.9064975009611688}
\definecolor{fau-med_dark-375}{rgb}{0.6235294117647059, 0.7667358708189158, 0.8597462514417532}
\definecolor{fau-med_dark-625}{rgb}{0.37254901960784315, 0.6112264513648596, 0.766243752402922}
\definecolor{fau-med_dark}{rgb}{0.0, 0.3803921568627451, 0.6274509803921569}
\definecolor{fau-med_light-125}{rgb}{0.9212610534409842, 0.9714571318723568, 0.9906497500961169}
\definecolor{fau-med_light-250}{rgb}{0.8425221068819685, 0.9429142637447135, 0.9812995001922338}
\definecolor{fau-med_light-375}{rgb}{0.7637831603229527, 0.9143713956170704, 0.9719492502883507}
\definecolor{fau-med_light-625}{rgb}{0.6063052672049212, 0.8572856593617839, 0.9532487504805844}
\definecolor{fau-med_light}{rgb}{0.37254901960784315, 0.7725490196078432, 0.9254901960784314}
\definecolor{fau-med}{rgb}{0.0, 0.6392156862745098, 0.8784313725490196}
\definecolor{fau-nat-125}{rgb}{0.9074817377931564, 0.9611226451364859, 0.8951787773933103}
\definecolor{fau-nat-250}{rgb}{0.8149634755863129, 0.922245290272972, 0.7903575547866205}
\definecolor{fau-nat-375}{rgb}{0.7224452133794694, 0.8833679354094579, 0.6855363321799308}
\definecolor{fau-nat-625}{rgb}{0.5374086889657823, 0.8056132256824298, 0.4758938869665513}
\definecolor{fau-nat-dark}{rgb}{0.13333333333333333, 0.5333333333333333, 0.2823529411764706}
\definecolor{fau-nat-light}{rgb}{0.5372549019607843, 0.803921568627451, 0.4745098039215686}
\definecolor{fau-nat_dark-125}{rgb}{0.8912418300653595, 0.941437908496732, 0.9099423298731257}
\definecolor{fau-nat_dark-250}{rgb}{0.782483660130719, 0.8828758169934641, 0.8198846597462515}
\definecolor{fau-nat_dark-375}{rgb}{0.6737254901960784, 0.8243137254901961, 0.7298269896193772}
\definecolor{fau-nat_dark-625}{rgb}{0.4562091503267973, 0.7071895424836601, 0.5497116493656287}
\definecolor{fau-nat_dark}{rgb}{0.13333333333333333, 0.5333333333333333, 0.2823529411764706}
\definecolor{fau-nat_light-125}{rgb}{0.9419300269127259, 0.9753940792003076, 0.9340561322568243}
\definecolor{fau-nat_light-250}{rgb}{0.8838600538254517, 0.9507881584006151, 0.8681122645136485}
\definecolor{fau-nat_light-375}{rgb}{0.8257900807381776, 0.9261822376009228, 0.8021683967704729}
\definecolor{fau-nat_light-625}{rgb}{0.7096501345636294, 0.8769703960015379, 0.6702806612841214}
\definecolor{fau-nat_light}{rgb}{0.5372549019607843, 0.803921568627451, 0.4745098039215686}
\definecolor{fau-nat}{rgb}{0.2627450980392157, 0.6901960784313725, 0.16470588235294117}
\definecolor{fau-phil-125}{rgb}{1.0, 0.9650595924644367, 0.8882891195693964}
\definecolor{fau-phil-250}{rgb}{1.0, 0.9301191849288735, 0.7765782391387928}
\definecolor{fau-phil-375}{rgb}{1.0, 0.8951787773933103, 0.6648673587081892}
\definecolor{fau-phil-625}{rgb}{1.0, 0.8252979623221838, 0.441445597846982}
\definecolor{fau-phil-dark}{rgb}{0.9098039215686274, 0.4666666666666667, 0.13333333333333333}
\definecolor{fau-phil-light}{rgb}{1.0, 0.8235294117647058, 0.44313725490196076}
\definecolor{fau-phil_dark-125}{rgb}{0.9886812764321414, 0.9330718954248366, 0.8912418300653595}
\definecolor{fau-phil_dark-250}{rgb}{0.977362552864283, 0.8661437908496732, 0.782483660130719}
\definecolor{fau-phil_dark-375}{rgb}{0.9660438292964244, 0.7992156862745098, 0.6737254901960784}
\definecolor{fau-phil_dark-625}{rgb}{0.9434063821607074, 0.6653594771241831, 0.4562091503267973}
\definecolor{fau-phil_dark}{rgb}{0.9098039215686274, 0.4666666666666667, 0.13333333333333333}
\definecolor{fau-phil_light-125}{rgb}{1.0, 0.9778546712802768, 0.9301191849288735}
\definecolor{fau-phil_light-250}{rgb}{1.0, 0.9557093425605536, 0.860238369857747}
\definecolor{fau-phil_light-375}{rgb}{1.0, 0.9335640138408304, 0.7903575547866205}
\definecolor{fau-phil_light-625}{rgb}{1.0, 0.889273356401384, 0.6505959246443676}
\definecolor{fau-phil_light}{rgb}{1.0, 0.8235294117647058, 0.44313725490196076}
\definecolor{fau-phil}{rgb}{1.0, 0.7215686274509804, 0.10980392156862745}
\definecolor{fau-tech-125}{rgb}{0.9330718954248366, 0.9527566320645905, 0.9635832372164552}
\definecolor{fau-tech-250}{rgb}{0.8661437908496732, 0.9055132641291811, 0.9271664744329104}
\definecolor{fau-tech-375}{rgb}{0.7992156862745098, 0.8582698961937716, 0.8907497116493657}
\definecolor{fau-tech-625}{rgb}{0.6653594771241831, 0.7637831603229527, 0.8179161860822761}
\definecolor{fau-tech-dark}{rgb}{0.2549019607843137, 0.4549019607843137, 0.5529411764705883}
\definecolor{fau-tech-light}{rgb}{0.6666666666666666, 0.7647058823529411, 0.8196078431372549}
\definecolor{fau-tech_dark-125}{rgb}{0.9064975009611688, 0.9315955401768551, 0.9438985005767013}
\definecolor{fau-tech_dark-250}{rgb}{0.8129950019223375, 0.8631910803537101, 0.8877970011534025}
\definecolor{fau-tech_dark-375}{rgb}{0.7194925028835064, 0.7947866205305651, 0.8316955017301038}
\definecolor{fau-tech_dark-625}{rgb}{0.532487504805844, 0.6579777008842753, 0.7194925028835064}
\definecolor{fau-tech_dark}{rgb}{0.2549019607843137, 0.4549019607843137, 0.5529411764705883}
\definecolor{fau-tech_light-125}{rgb}{0.9581699346405229, 0.970472895040369, 0.977362552864283}
\definecolor{fau-tech_light-250}{rgb}{0.9163398692810457, 0.9409457900807382, 0.954725105728566}
\definecolor{fau-tech_light-375}{rgb}{0.8745098039215686, 0.9114186851211072, 0.9320876585928489}
\definecolor{fau-tech_light-625}{rgb}{0.7908496732026143, 0.8523644752018454, 0.8868127643214149}
\definecolor{fau-tech_light}{rgb}{0.6666666666666666, 0.7647058823529411, 0.8196078431372549}
\definecolor{fau-tech}{rgb}{0.4666666666666667, 0.6235294117647059, 0.7098039215686275}
\definecolor{fau-wiso-125}{rgb}{0.9729334871203383, 0.8823836985774702, 0.8971472510572857}
\definecolor{fau-wiso-250}{rgb}{0.9458669742406767, 0.7647673971549405, 0.7942945021145713}
\definecolor{fau-wiso-375}{rgb}{0.918800461361015, 0.6471510957324107, 0.691441753171857}
\definecolor{fau-wiso-625}{rgb}{0.8646674356016917, 0.41191849288735105, 0.4857362552864283}
\definecolor{fau-wiso-dark}{rgb}{0.592156862745098, 0.10588235294117647, 0.1843137254901961}
\definecolor{fau-wiso-light}{rgb}{0.8627450980392157, 0.4117647058823529, 0.48627450980392156}
\definecolor{fau-wiso_dark-125}{rgb}{0.9488196847366398, 0.8877970011534025, 0.8976393694732795}
\definecolor{fau-wiso_dark-250}{rgb}{0.8976393694732795, 0.7755940023068051, 0.795278738946559}
\definecolor{fau-wiso_dark-375}{rgb}{0.8464590542099193, 0.6633910034602075, 0.6929181084198386}
\definecolor{fau-wiso_dark-625}{rgb}{0.7440984236831988, 0.4389850057670127, 0.48819684736639757}
\definecolor{fau-wiso_dark}{rgb}{0.592156862745098, 0.10588235294117647, 0.1843137254901961}
\definecolor{fau-wiso_light-125}{rgb}{0.9827758554402153, 0.9261822376009228, 0.9355324875048059}
\definecolor{fau-wiso_light-250}{rgb}{0.9655517108804306, 0.8523644752018454, 0.8710649750096117}
\definecolor{fau-wiso_light-375}{rgb}{0.948327566320646, 0.7785467128027681, 0.8065974625144176}
\definecolor{fau-wiso_light-625}{rgb}{0.9138792772010765, 0.6309111880046137, 0.6776624375240292}
\definecolor{fau-wiso_light}{rgb}{0.8627450980392157, 0.4117647058823529, 0.48627450980392156}
\definecolor{fau-wiso}{rgb}{0.7843137254901961, 0.06274509803921569, 0.1803921568627451}
13 changes: 11 additions & 2 deletions fau_colors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
__version__ = "1.4.3"

from fau_colors._utils import export_as_gpl
from fau_colors._utils import export_as_gpl, export_as_tex
from fau_colors.fonts import register_fausans_font
from fau_colors.v2021 import cmaps, colors, colors_all, colors_dark, colors_light, register_cmaps, unregister_cmaps
from fau_colors.v2021 import (
cmaps,
cmaps_with_names,
colors,
colors_all,
colors_dark,
colors_light,
register_cmaps,
unregister_cmaps,
)
26 changes: 26 additions & 0 deletions fau_colors/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,29 @@ def export_as_gpl(colors: Sequence[List[Tuple[float, float, float]]], file_name:
with open(Path(folder_path) / file_name, "w") as f:
f.write(HEADER)
f.write(body)


def export_as_tex(
colors: Sequence[Tuple[List[str], List[Tuple[float, float, float]]]], file_name: str, folder_path: Path
):
assert file_name.endswith("tex"), "`name` must end with '.tex'"
HEADER = (
f"% Tex color file defining the FAU colors.\n"
"% To use, you need to include the `xcolor` package (\\usepackage{xcolor} in your preamble).\n"
f"% Then copy this file into your project and include it with `\\input{{{file_name}}}`."
)

color_strings = []
for cmap in colors:
for name, rgb in zip(*cmap):
color_as_rgb = matplotlib.colors.to_rgb(rgb)
color_strings.append(
f"\\definecolor{{{name}}}{{rgb}}{{{color_as_rgb[0]}, {color_as_rgb[1]}, {color_as_rgb[2]}}}"
)

color_strings = sorted(set(color_strings))

body = "\n".join(color_strings)
with open(Path(folder_path) / file_name, "w") as f:
f.write(HEADER)
f.write(body)
33 changes: 21 additions & 12 deletions fau_colors/v2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"colors_dark",
"colors_light",
"cmaps",
"cmaps_with_names",
"register_cmaps",
"unregister_cmaps",
]
Expand Down Expand Up @@ -69,20 +70,28 @@
**{f"{k}_light": v for k, v in colors_light._asdict().items()},
)

cmaps = _CmapsAll(
faculties=sns.color_palette(list(colors), as_cmap=True),
faculties_dark=sns.color_palette(list(colors_dark), as_cmap=True),
faculties_light=sns.color_palette(list(colors_light), as_cmap=True),
faculties_all=sns.color_palette(list(colors_all), as_cmap=True),
**{
k: sns.color_palette(
custom_blend_colormap(["#FFFFFF", v], list(reversed(_LIGHTNESS_LEVELS))),
as_cmap=True,
)
for k, v in colors_all._asdict().items()
},

lightened_colors = {}
reversed_light_levels = _LIGHTNESS_LEVELS[::-1]
lightness_name_postfix = [f"-{int(i*1000)}" if i != 1 else "" for i in reversed_light_levels]
for name, color in colors_all._asdict().items():
lightened_colors[name] = (
[f"fau-{name}{p}" for p in lightness_name_postfix],
custom_blend_colormap(["#FFFFFF", color], reversed_light_levels),
)

cmaps_with_names = _CmapsAll(
faculties=([f"fau-{f}" for f in colors._fields], sns.color_palette(list(colors), as_cmap=True)),
faculties_dark=([f"fau-{f}-dark" for f in colors_dark._fields], sns.color_palette(list(colors_dark), as_cmap=True)),
faculties_light=(
[f"fau-{f}-light" for f in colors_light._fields],
sns.color_palette(list(colors_light), as_cmap=True),
),
faculties_all=([f"fau-{f}" for f in colors_all._fields], sns.color_palette(list(colors_all), as_cmap=True)),
**lightened_colors,
)

cmaps = _CmapsAll(**{name: cmap[1] for name, cmap in cmaps_with_names._asdict().items()})

register_cmaps = get_register_func(cmaps)
unregister_cmaps = get_unregister_func(cmaps)

0 comments on commit fc2e046

Please sign in to comment.