尧图建网站 尧图建网站 YAOTU WEB BUILD 免费咨询
ARTICLE DETAIL

资讯详情

深耕网站建设与建站编程的一线实战洞察。

Seaborn调色板全解析:构建可搜索的颜色字典提升数据可视化效率

Seaborn调色板全解析:构建可搜索的颜色字典提升数据可视化效率 1. 项目概述为什么我们需要一份Seaborn调色板的“颜色字典”做数据可视化的朋友尤其是用Python的Matplotlib和Seaborn库的肯定都遇到过这个场景图做出来了数据也清晰但总觉得配色差点意思。要么是默认的颜色太单调几个序列分不清要么是想用一组高级的渐变色却不知道Seaborn里哪个调色板最合适更头疼的是想手动指定一组和谐的颜色却对Seaborn内置的色板到底长什么样、叫什么名字毫无头绪。这时候你可能会去翻官方文档但文档往往是文字描述加几个示例图想要快速浏览、对比所有颜色组合效率极低。“Seaborn调色板中所有颜色组合(表格整理版)”这个项目就是为了解决这个痛点而生的。它本质上是一份为数据可视化从业者准备的“颜色字典”或“色卡手册”。我不再满足于在代码里一个个palette去试也不再依赖记忆去回想“husl”和“hls”到底有什么区别。我要做的是通过程序化遍历将Seaborn库中所有可用的调色板——包括分类色板、顺序色板、发散色板甚至那些通过light_palette,dark_palette,diverging_palette函数动态生成的色板——的颜色值RGB或HEX提取出来并以结构清晰的表格形式比如Markdown表格、CSV或Pandas DataFrame呈现。这份表格的价值在于可搜索、可对比、可复用。当你需要一个表现冷色调的顺序色板时你可以快速在表格中找到“blues”、“icefire”的具体颜色序列当你想为你的分类数据寻找一组高对比度且美观的颜色时你可以直接对比“Set2”、“tab20c”、“husl”等调色板的颜色构成。它把Seaborn这个强大的视觉美化工具从“黑盒”变成了可视化的、可查询的素材库极大地提升了我们配色的决策效率和审美下限。无论你是刚入门的新手还是需要频繁出图的老手手边备上这么一份表格都能让你的图表在几分钟内焕然一新。2. 核心思路与实现路径设计要实现这个“颜色字典”我们不能蛮干。Seaborn的调色板系统虽然统一在sns.color_palette()这个接口下但其来源和类型是多样的。我的核心思路是分类别、分函数进行系统性地抓取和整理确保覆盖全面同时结构清晰方便后续查询。2.1 调色板类型梳理与抓取策略首先我们需要明确Seaborn调色板的几大来源这决定了我们的抓取路径内置命名调色板这是最常用的一类。通过sns.color_palette(“名字”)直接调用。它们又分为分类色板用于区分没有内在顺序的离散类别。如“deep”,“muted”,“pastel”,“bright”,“dark”,“colorblind”,“Set1-3”,“tab10”,“tab20”等。顺序色板用于表示从低到高有顺序的数据。如“rocket”,“mako”,“crest”,“flare”,“viridis”,“plasma”,“summer”,“wistia”等。发散色板用于强调中间值同时向两端变化的数据。如“vlag”,“icefire”,“RdBu”,“Spectral”等。Matplotlib色彩映射Seaborn兼容Matplotlib的colormap。我们可以通过sns.color_palette(“viridis”, as_cmapFalse)来获取其离散颜色列表。这部分数量庞大我们需要有选择地抓取常用的一些。动态生成调色板通过sns.light_palette()、sns.dark_palette()、sns.diverging_palette()等函数可以基于一个种子颜色生成一套渐变色。这部分是“无限”的我们的策略是预设一批常用且美观的种子颜色如“blue”,“red”,“green”,“purple”然后生成具有代表性的颜色序列加入表格。HUSL/HLS色彩空间调色板通过sns.husl_palette()或sns.hls_palette()可以生成在对应色彩空间下均匀分布的颜色。这类调色板颜色鲜艳、对比度高。我们可以固定几个参数如色相数n_colors6生成代表性子集。注意抓取时务必指定as_cmapFalse以确保sns.color_palette()返回的是一个颜色值列表而不是一个LinearSegmentedColormap对象后者无法直接获取颜色值列表。2.2 数据结构与表格设计抓取到的颜色信息我们需要用一个结构化的方式来存储。一个Pandas DataFrame是最佳选择它易于处理、筛选并能方便地导出为CSV、Markdown或Excel。我设计的核心表格字段如下palette_name: 调色板名称或标识如“deep”,“rocket_6”,“light_blue”。palette_type: 调色板类型“categorical”,“sequential”,“diverging”,“generated_light”,“generated_dark”,“generated_diverging”,“husl/hls”。n_colors: 该调色板实例的颜色数量。对于内置调色板通常抓取6色对于动态生成的按参数记录。color_1到color_n(例如color_1,color_2, …color_6): 存储每个位置的颜色值格式为十六进制字符串如“#4C72B0”。这是最直观、最通用的格式。colors_list: 将整个颜色列表存储为一个Python列表的字符串形式如“[#4C72B0’ ‘#55A868’ …]”方便程序化读取。source: 来源说明如“builtin”,“matplotlib”,“generated”。这样的设计既支持按名称、类型进行快速筛选也支持直接复制颜色值使用还能保留完整的原始列表供程序调用。2.3 实现工具链选择工欲善其事必先利其器。这个项目主要依赖Python生态中的几个核心库Seaborn Matplotlib: 基础用于获取和显示调色板。Pandas: 核心数据处理与表格构建工具。NumPy: 辅助计算特别是在处理颜色值转换时。Jupyter Notebook / Lab: 强烈推荐。这是一个交互式探索和开发的绝佳环境。你可以实时运行代码块查看生成的色板预览和表格迭代调整非常方便。这也是解决“pycharm添加不上seaborn库”这类环境问题的最佳实践场所——问题隔离和排查更清晰。关于网络热词中提到的“pycharm添加不上seaborn库”这本质上是一个Python环境管理问题。我的经验是永远不要直接使用系统Python或Pycharm默认的虚拟环境。我强烈推荐使用conda或mamba来创建独立、纯净的项目环境。在终端中执行conda create -n seaborn-color python3.9 seaborn pandas jupyter matplotlib然后激活环境再在Pycharm中选用这个解释器可以99%避免此类库安装冲突。如果遇到网络问题可以配置清华、阿里等国内镜像源。3. 核心代码实现与颜色抓取实战理论清晰了我们开始动手写代码。我会分步骤将上述思路转化为可执行的Python脚本。3.1 环境准备与基础函数定义首先确保环境正确并导入必要的库。import seaborn as sns import pandas as pd import matplotlib.pyplot as plt import matplotlib import numpy as np from typing import List, Tuple, Dict, Any # 设置Seaborn样式让我们的预览图更好看 sns.set_theme(stylewhitegrid)接下来定义几个核心工具函数。第一个函数负责将Seaborn返回的颜色值通常是RGB元组范围0-1转换为网页和设计软件通用的十六进制HEX格式。def rgb_to_hex(rgb_tuple: Tuple[float, float, float]) - str: 将 (R, G, B) 元组每个值在0-1之间转换为十六进制颜色字符串。 # 将0-1范围的浮点数转换为0-255范围的整数 r, g, b [int(round(x * 255)) for x in rgb_tuple] # 格式化为 #RRGGBB return f#{r:02x}{g:02x}{b:02x}.upper() def get_palette_colors(palette_name: str, n_colors: int 6) - List[str]: 获取指定调色板名称和颜色数量的HEX颜色列表。 参数: palette_name: 调色板名称 n_colors: 颜色数量默认为6 返回: 包含n_colors个HEX颜色字符串的列表 try: # 获取颜色列表确保返回的是列表而非colormap palette sns.color_palette(palette_name, n_colorsn_colors, as_cmapFalse) # 转换为HEX格式 hex_colors [rgb_to_hex(color) for color in palette] return hex_colors except Exception as e: # 如果调色板不存在或其他错误返回空列表并打印警告 print(f警告: 无法获取调色板 {palette_name}错误: {e}) return []3.2 系统抓取内置与Matplotlib调色板现在我们开始系统地遍历Seaborn文档中提到的常用内置调色板以及一部分优秀的Matplotlib colormap。def build_basic_palette_table() - pd.DataFrame: 构建包含Seaborn内置命名调色板和精选Matplotlib colormap的表格。 rows [] # 1. Seaborn 内置分类色板 (Categorical) categorical_palettes [ deep, muted, bright, pastel, dark, colorblind, Set1, Set2, Set3, tab10, tab20, tab20b, tab20c ] for name in categorical_palettes: colors get_palette_colors(name, 6) # 分类色板通常取6色足够 if colors: row { palette_name: name, palette_type: categorical, n_colors: len(colors), colors_list: str(colors) } # 将颜色分别存入color_1, color_2, ... 字段 for i, col in enumerate(colors, 1): row[fcolor_{i}] col rows.append(row) # 2. Seaborn 内置顺序色板 (Sequential) - 这些是Seaborn特色的现代渐变色 sequential_palettes [ rocket, mako, crest, flare, viridis, plasma, summer, wistia, magma, inferno ] for name in sequential_palettes: colors get_palette_colors(name, 6) if colors: row { palette_name: name, palette_type: sequential, n_colors: len(colors), colors_list: str(colors) } for i, col in enumerate(colors, 1): row[fcolor_{i}] col rows.append(row) # 3. Seaborn 内置发散色板 (Diverging) diverging_palettes [vlag, icefire, RdBu, Spectral, coolwarm, bwr] for name in diverging_palettes: colors get_palette_colors(name, 7) # 发散色板通常取奇数个以突出中间值 if colors: row { palette_name: name, palette_type: diverging, n_colors: len(colors), colors_list: str(colors) } for i, col in enumerate(colors, 1): row[fcolor_{i}] col rows.append(row) # 4. 精选的Matplotlib colormap (作为顺序色板补充) matplotlib_cmaps [Greys, Blues, Greens, Oranges, Reds, Purples, spring, summer, autumn, winter, cool, hot] for name in matplotlib_cmaps: colors get_palette_colors(name, 6) if colors: row { palette_name: fmpl_{name}, # 加前缀以示区别 palette_type: sequential, n_colors: len(colors), colors_list: str(colors) } for i, col in enumerate(colors, 1): row[fcolor_{i}] col rows.append(row) # 创建DataFrame df pd.DataFrame(rows) # 确保列的顺序基本信息列 动态的颜色列 base_cols [palette_name, palette_type, n_colors, colors_list] color_cols [col for col in df.columns if col.startswith(color_)] # 对颜色列进行排序让color_1, color_2...顺序排列 color_cols_sorted sorted(color_cols, keylambda x: int(x.split(_)[1])) df df[base_cols color_cols_sorted] return df # 执行抓取 basic_df build_basic_palette_table() print(f已抓取基础调色板数量: {len(basic_df)}) print(basic_df[[palette_name, palette_type, n_colors]].head())3.3 动态生成调色板的抓取与整合动态调色板是Seaborn的亮点我们需要用函数生成一批有代表性的。def build_generated_palette_table() - pd.DataFrame: 构建通过sns.light_palette, dark_palette, diverging_palette生成的调色板表格。 rows [] seed_colors [blue, green, red, purple, orange, brown, pink, gray] n_colors_set [6, 8] # 测试两种颜色数量 # 1. 浅色渐变 (light_palette) for seed in seed_colors: for n in n_colors_set: try: # reverseTrue 生成从深到浅False从浅到深。我们各取一种。 for reverse in [False, True]: palette sns.light_palette(seed, n_colorsn, reversereverse, as_cmapFalse) hex_colors [rgb_to_hex(c) for c in palette] suffix _rev if reverse else row { palette_name: flight_{seed}_{n}{suffix}, palette_type: generated_light, n_colors: n, colors_list: str(hex_colors) } for i, col in enumerate(hex_colors, 1): row[fcolor_{i}] col rows.append(row) except Exception as e: print(f生成 light_palette({seed}, {n}) 时出错: {e}) # 2. 深色渐变 (dark_palette) - 逻辑类似 for seed in seed_colors: for n in n_colors_set: try: for reverse in [False, True]: palette sns.dark_palette(seed, n_colorsn, reversereverse, as_cmapFalse) hex_colors [rgb_to_hex(c) for c in palette] suffix _rev if reverse else row { palette_name: fdark_{seed}_{n}{suffix}, palette_type: generated_dark, n_colors: n, colors_list: str(hex_colors) } for i, col in enumerate(hex_colors, 1): row[fcolor_{i}] col rows.append(row) except Exception as e: print(f生成 dark_palette({seed}, {n}) 时出错: {e}) # 3. 发散色板 (diverging_palette) - 需要两个种子色 # 我们组合几种常见的冷暖对比色 diverging_pairs [(red, blue), (green, purple), (brown, teal)] for c1, c2 in diverging_pairs: for n in [7, 9]: # 发散色板常用奇数 try: palette sns.diverging_palette(c1, c2, nn, as_cmapFalse) hex_colors [rgb_to_hex(c) for c in palette] row { palette_name: fdiv_{c1}_{c2}_{n}, palette_type: generated_diverging, n_colors: n, colors_list: str(hex_colors) } for i, col in enumerate(hex_colors, 1): row[fcolor_{i}] col rows.append(row) except Exception as e: print(f生成 diverging_palette({c1}, {c2}, {n}) 时出错: {e}) # 创建DataFrame df pd.DataFrame(rows) # 同样整理列顺序 base_cols [palette_name, palette_type, n_colors, colors_list] color_cols sorted([col for col in df.columns if col.startswith(color_)], keylambda x: int(x.split(_)[1])) df df[base_cols color_cols] return df generated_df build_generated_palette_table() print(f已抓取动态生成调色板数量: {len(generated_df)})3.4 HUSL/HLS色彩空间调色板抓取这类调色板在色彩空间上均匀分布非常适合需要多个高区分度颜色的场景。def build_husl_hls_table() - pd.DataFrame: 构建HUSL和HLS色彩空间的调色板表格。 rows [] # 我们可以生成不同数量、不同起始色相的颜色 n_colors_options [6, 8, 10] h_start_options [0, 30, 60] # 不同的起始色相角度 # HUSL 调色板 (通常认为比HLS更均匀) for n in n_colors_options: for h in h_start_options: try: palette sns.husl_palette(n_colorsn, hh, as_cmapFalse) hex_colors [rgb_to_hex(c) for c in palette] row { palette_name: fhusl_n{n}_h{h}, palette_type: husl, n_colors: n, colors_list: str(hex_colors) } for i, col in enumerate(hex_colors, 1): row[fcolor_{i}] col rows.append(row) except Exception as e: print(f生成 husl_palette(n{n}, h{h}) 时出错: {e}) # HLS 调色板 for n in n_colors_options: for h in h_start_options: try: palette sns.hls_palette(n_colorsn, hh, as_cmapFalse) hex_colors [rgb_to_hex(c) for c in palette] row { palette_name: fhls_n{n}_h{h}, palette_type: hls, n_colors: n, colors_list: str(hex_colors) } for i, col in enumerate(hex_colors, 1): row[fcolor_{i}] col rows.append(row) except Exception as e: print(f生成 hls_palette(n{n}, h{h}) 时出错: {e}) df pd.DataFrame(rows) base_cols [palette_name, palette_type, n_colors, colors_list] color_cols sorted([col for col in df.columns if col.startswith(color_)], keylambda x: int(x.split(_)[1])) df df[base_cols color_cols] return df husl_hls_df build_husl_hls_table() print(f已抓取HUSL/HLS调色板数量: {len(husl_hls_df)})3.5 数据合并、清洗与导出最后我们将所有抓取到的调色板数据合并成一张总表并进行清洗和导出。# 合并所有DataFrame full_palette_df pd.concat([basic_df, generated_df, husl_hls_df], ignore_indexTrue) # 数据清洗检查是否有重复或空行 print(f合并后总调色板数量: {len(full_palette_df)}) print(fpalette_name 重复项: {full_palette_df.duplicated(subset[palette_name]).sum()}) # 如果有重复可以根据需要去重这里我们按名称保留第一个 full_palette_df full_palette_df.drop_duplicates(subset[palette_name], keepfirst).reset_index(dropTrue) print(f去重后总调色板数量: {len(full_palette_df)}) # 填充可能存在的NaN值某些调色板颜色数少导致color_7, color_8等列为NaN # 我们用空字符串填充使表格更整洁 color_cols [col for col in full_palette_df.columns if col.startswith(color_)] full_palette_df[color_cols] full_palette_df[color_cols].fillna() # 导出为CSV文件这是最通用的格式 csv_filename seaborn_color_palettes_full.csv full_palette_df.to_csv(csv_filename, indexFalse, encodingutf-8-sig) # utf-8-sig支持Excel直接打开不乱码 print(f已导出完整调色板表格至: {csv_filename}) # 同时我们可以生成一个更易读的Markdown版本用于在文档或博客中展示 def df_to_markdown_table(df: pd.DataFrame, max_rows: int 20) - str: 将DataFrame的前max_rows行转换为Markdown表格字符串。 # 为了在Markdown中可读我们只展示关键列和少量颜色示例 display_cols [palette_name, palette_type, n_colors, color_1, color_2, color_3] display_df df[display_cols].head(max_rows).copy() # 在Markdown中我们可以用HTML的span标签带背景色来直观显示颜色 def color_cell(hex_code): if pd.isna(hex_code) or hex_code : return # 返回一个带有背景色和颜色代码的HTML片段 return fspan styledisplay: inline-block; width: 60px; height: 20px; background-color: {hex_code}; border: 1px solid #ccc; text-align: center; font-size: 0.8em; line-height: 20px; color: {(“#000” if (int(hex_code[1:3],16)*0.299 int(hex_code[3:5],16)*0.587 int(hex_code[5:7],16)*0.114) 186 else “#fff”)}{hex_code}/span for col in [color_1, color_2, color_3]: display_df[col] display_df[col].apply(color_cell) return display_df.to_markdown(indexFalse) # 生成Markdown预览 md_preview df_to_markdown_table(full_palette_df, 15) print(\n--- Markdown 表格预览 (前15行) ---) print(md_preview) # 也可以将完整的Markdown表格写入文件 with open(seaborn_color_palettes_preview.md, w, encodingutf-8) as f: f.write(full_palette_df.to_markdown(indexFalse)) print(已生成Markdown预览文件。)运行完以上代码你就得到了一份包含数百个Seaborn调色板颜色组合的详细表格CSV文件。这个文件就是你的“颜色字典”核心资产。4. 表格的使用技巧与场景化应用有了这份表格怎么用才能最大化它的价值这里分享几个我实践中总结的高效用法。4.1 快速查询与筛选你可以用Pandas或者直接在任何支持表格的软件如Excel, Numbers, Google Sheets中打开CSV文件进行筛选。按类型筛选当你需要做热力图时在Excel中筛选palette_type为“sequential”然后滚动查看color_1到color_6的颜色渐变快速找到心仪的“mako”或“rocket”。按颜色数量筛选你的图表需要展示8个类别就筛选n_colors大于等于8的调色板排除那些颜色数不够的选项。按名称搜索模糊记得一个叫“ice”什么的调色板在palette_name列里搜索“ice”就能定位到“icefire”。4.2 在Jupyter Notebook中交互式预览表格是死的颜色是活的。最好的使用方式是在Jupyter Notebook中结合代码进行交互式预览。你可以写一个简单的预览函数def preview_palette(palette_name: str, n: int 6): 在Jupyter中绘制指定调色板的颜色条。 try: palette sns.color_palette(palette_name, n) sns.palplot(palette) plt.title(f“Palette: {palette_name} (n{n})”, fontsize12) plt.show() # 同时打印HEX值 hex_list [rgb_to_hex(c) for c in palette] print(“HEX Codes:”, hex_list) except Exception as e: print(f“无法预览调色板 ‘{palette_name}’: {e}”) # 示例预览我们表格中的几个调色板 preview_palette(‘deep’) preview_palette(‘rocket’, 8) preview_palette(‘light_blue_6’)这样你在表格里看到一个名字运行一下preview_palette就能立刻看到它的实际效果决策速度飞快。4.3 集成到你的绘图工作流中这份表格的终极用途是直接为你的绘图代码提供颜色方案。你可以写一个工具函数从表格中读取颜色列表并应用到你的图表中。假设你的表格文件是“seaborn_color_palettes_full.csv”import pandas as pd def get_colors_from_table(palette_name: str, df_path“seaborn_color_palettes_full.csv”): 从本地表格中根据名称获取颜色HEX列表。 df pd.read_csv(df_path) row df[df[‘palette_name’] palette_name] if row.empty: print(f“未找到调色板: {palette_name}”) return None # 从‘colors_list’列中还原列表 colors_list_str row.iloc[0][‘colors_list’] # 安全地将字符串形式的列表转换为真正的列表 import ast try: colors_hex_list ast.literal_eval(colors_list_str) return colors_hex_list except: # 如果解析失败尝试手动提取颜色列 color_cols [col for col in row.columns if col.startswith(‘color_’)] colors_hex_list [row.iloc[0][col] for col in color_cols if row.iloc[0][col] ! ‘’] return colors_hex_list # 在绘图时使用 target_palette ‘div_red_blue_7’ my_colors get_colors_from_table(target_palette) if my_colors: # 示例用这组颜色绘制一个简单的条形图 import matplotlib.pyplot as plt data [10, 15, 7, 12, 9, 11, 8] categories [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’] plt.figure(figsize(8,5)) bars plt.bar(categories, data, colormy_colors) plt.title(f“Using Palette: {target_palette}”) # 还可以在柱子上标注颜色值 for bar, color in zip(bars, my_colors): bar.set_label(color) plt.legend() plt.show()通过这种方式你管理配色方案就像管理一个数据库彻底告别了在代码和文档之间来回切换的麻烦。5. 常见问题、避坑指南与扩展思路在构建和使用这个颜色表格的过程中我踩过一些坑也总结出一些能让它更强大的扩展思路。5.1 常见问题与解决方案调色板名称错误或不存在Seaborn的版本迭代可能会增减或重命名调色板。我的代码中加入了try…except块来捕获异常并跳过。建议定期在你的Python环境中运行sns.color_palette()并打印sns.palettes.SEABORN_PALETTES等属性来获取当前版本支持的完整列表并更新你的抓取脚本。颜色数量n_colors的影响对于连续调色板如“viridis”指定不同的n_colors会得到不同的颜色插值结果。我们的表格固定抓取了n6或n7这是一个折中的通用值。如果你需要更多或更少的颜色记住可以通过sns.color_palette(“viridis”, n_colors12)直接获取我们的表格主要起“样品”和“目录”的作用。动态调色板参数组合爆炸light_palette、diverging_palette等函数参数很多hue,saturation,lightness等。我们只抓取了最常见、最实用的组合。如果你的项目有非常特殊的配色需求完全可以修改build_generated_palette_table函数增加参数扫描范围生成属于你的超级色板库。表格文件过大如果抓取了非常多的动态调色板CSV文件可能会达到几MB。对于日常使用我建议保留我们上面抓取的经典集合即可大约200-300行。你可以将完整的抓取脚本和精简版的表格文件一起归档需要时再重新生成完整版。5.2 独家避坑技巧技巧一为调色板添加“适用场景”标签。在构建表格时可以手动或基于规则为每个调色板添加一个tags字段比如[“分类图”, “热图”, “冷色调”, “高对比度”, “色盲友好”]。这样你可以通过标签进行多维筛选比如快速找出所有“色盲友好”且适用于“分类图”的调色板。技巧二存储颜色亮度值。在抓取颜色时可以计算其相对亮度Relative Luminance公式为(0.299*R 0.587*G 0.114*B)。将这个值存入表格的luminance列或每个颜色对应的亮度。当你需要在深色或浅色背景上选择文字颜色时这个数据非常有用——你可以快速判断某个颜色在特定背景下是否具有足够的对比度。技巧三生成预览图并嵌入表格。更高级的做法是在抓取每个调色板时用matplotlib生成一个小色条图片然后将图片的Base64编码或相对路径存入表格。这样在支持HTML渲染的环境如Jupyter、某些数据库前端中你可以直接看到颜色无需运行代码预览。不过这会显著增加表格的复杂度和体积适合内部工具开发。5.3 项目扩展思路这个“颜色字典”项目可以作为一个起点扩展成更强大的数据可视化辅助工具Web可视化工具使用Flask或Streamlit搭建一个简单的Web应用上传你的CSV表格前端提供按类型、颜色数量、主色调筛选的功能并且点击调色板名称就能实时显示颜色条和生成对应的Matplotlib/Seaborn代码片段。这对于团队共享配色规范极其有用。配色方案导出增加功能将选中的调色板颜色导出为Adobe Swatch Exchange (.ase)、Sketch Palette (.sketchpalette) 或.clr(macOS) 格式方便设计师在Adobe系列或Sketch等软件中直接使用打通数据分析与视觉设计的链路。自动配色建议基于图像或品牌主色从你的颜色表格中推荐匹配的Seaborn调色板。这需要引入一些色彩相似度计算如计算在Lab色彩空间下的Delta E但能实现智能化的配色推荐。这个项目花一两天时间搭建起来却能为你之后无数个数据可视化项目节省大量纠结于配色的时间。它把Seaborn这个强大的美学武器从“感觉”变成了“数据”让你能像查询数据库一样科学、高效地管理你的图表颜值。
返回列表