pythonic awesome样式表语言
Pass的Python项目详细描述
http://github.com/rimvaliulin/pass
pythonic awesome样式表语言。
关于
pass是一种面向web开发人员的动态样式表语言和css预处理器,它使ccs编码变得简单,并且 通过具有动态行为(如变量、继承、操作和函数)和类似python的缩进语法而变得漂亮。
安装
pip install pass
命令行用法
pass style.pass
代码中的用法
import Pass Pass('style.pass')
语法
- Every piece of knowledge must have a single, unambiguous, authoritative representation within a system. “DRY - don’t repeat yourself”
- There should be one — and preferably only one — obvious way to do it”, from “The Zen of Python”.
变量和运算符
变量允许您在一个地方指定广泛使用的值,然后在整个样式表中重用它们, 使全局更改像更改一行代码一样简单。
^{pr 4}$ | ^{pr 5}$ |
嵌套选择器
您可以简单地嵌套选择器,而不是构造长选择器名称来指定继承。 在其他选择器中。
^{pr 6}$ | ^{pr 7}$ |
选择器继承
类命名方案:
block-[element] [child_]parent-[[parent]_child]
^{pr 9}$ | ^{pr 10}$ |
父指令
用法:
@parent "style.pass"
功能
颜色初始化
r g b(r,g,b)-将rgb(r,g,b)三元组转换为颜色
rgba(r,g,b,a)-将rgba(r,g,b,a)四胞胎转换为颜色。
h s l(h,s,l)-将hsl(h,s,l)三元组转换为颜色。
HSLA(H,S,L,A)-将HSLA(H,S,L)四胞胎转换为颜色。
获取/设置颜色组件
红色(color,value=none)-返回给定颜色的红色分量。
绿色(color,value=none)-返回给定颜色的绿色分量。
蓝色(color,value=none)-返回给定颜色的蓝色分量。
色调(color,value=none)-返回给定颜色的色调。
饱和度(color,value=none)-返回给定颜色的饱和度。
亮度(color,value=none)-返回给定颜色的亮度。
alpha(color,value=none)-返回给定颜色的alpha分量。
颜色调整
spinin(color,value=pr(10))-更改颜色的色调。
微调(color,value=pr(10))-更改颜色的色调。
变亮(color,value=pr(10))-使颜色变亮。
变暗(color,value=pr(10))-使颜色变暗。
饱和(颜色,值=pr(10))-使颜色更饱和。
eSaturate(color,value=pr(10))-使颜色不太饱和。
fadein(color,value=pr(10))-为任何颜色值添加或更改alpha层。
淡出(color,value=pr(10))-为任何颜色值添加或更改alpha层。
灰度(颜色)-将颜色转换为灰度。
补码(颜色)-返回颜色的补码。
反转(颜色)-返回颜色的反转。
mix(color,color1,weight=pr(50))-将两种颜色混合在一起。
字符串函数
引号-从字符串中删除引号。
取消引号-将引号添加到字符串。
数字函数
百分比(值)-将无单位数字转换为百分比。
舍入(值,位数=0)-将数字舍入到最接近的整数。
ceil(value)-将数字舍入到最接近的整数。
楼层(值)-将数字向下舍入到最接近的整数。
命令行选项
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
-i, --inherit | use selector inheritance, rather then property duplication |
-c, --compressed | |
compress imported .css files | |
-e, --empty-selectors | |
keep empty selectors | |
-r, --respect-indents | |
respect indentes | |
-n, --newlines | use newlines |
-I INDENT, --indent=INDENT | |
.pass file indentation. default 2 breaks | |
-C CSS_INDENT, --css-indent=CSS_INDENT | |
.css file indentation. default 4 breaks | |
-C CSS_INDENT, --css-indent=CSS_INDENT | |
.css file indentation. default 4 breaks |
许可证
请参阅LICENSE文件。
> Copyright (c) 2012 Rim Valiulin
Author: | Rim Valiulin |
---|