小编Lia*_*oev的帖子

如何根据YAML前端物质设置背景颜色(Jekyll)

我希望能够根据YAML前端定义的颜色设置帖子的背景颜色.

这个主题是这样的:单页(github here)

但我无法理解它是如何完成的.CSS文件中的这段代码就是这样的:

{% for c in site.colors %}
.border-{{c[0]}} { border-color: {{ c[1] }} !important; }
.text-{{c[0]}}   { color: {{ c[1] }}; }
.text-{{c[0]}} a { color: {{ c[1] }}; }
.bg-{{c[0]}}     { background-color: {{ c[1] }} !important; }
{% endfor %}

/* ----- per-post colors! ----- */
{% for node in site.posts %}
  {% capture id %}{{ node.id | remove:'/' | downcase }}{% endcapture %}
  {% capture bg %}{% if site.colors[node.bg] %}{{ site.colors[node.bg] …
Run Code Online (Sandbox Code Playgroud)

html css jekyll

8
推荐指数
1
解决办法
3023
查看次数

标签 统计

css ×1

html ×1

jekyll ×1