builtins.less 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // builtin
  2. @something: "hello world";
  3. @color: #112233;
  4. @color2: rgba(44,55,66, .6);
  5. body {
  6. color: @something;
  7. @num: 7 / 6;
  8. num-basic: @num + 4;
  9. num-floor: floor(@num) + 4px;
  10. num-ceil: ceil(@num) + 4px;
  11. @num2: 2 / 3;
  12. num2: @num2;
  13. num2-round: round(@num2);
  14. num2-floor: floor(@num2);
  15. num2-ceil: ceil(@num2);
  16. round-lit: round(10px / 3);
  17. rgba1: rgbahex(@color);
  18. rgba2: rgbahex(@color2);
  19. argb: argb(@color2);
  20. }
  21. format {
  22. @r: 32;
  23. format: %("rgb(%d, %d, %d)", @r, 128, 64);
  24. format-string: %("hello %s", "world");
  25. format-multiple: %("hello %s %d", "earth", 2);
  26. format-url-encode: %('red is %A', #ff0000);
  27. eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64));
  28. }
  29. #functions {
  30. str1: isstring("hello");
  31. str2: isstring(one, two);
  32. num1: isnumber(2323px);
  33. num2: isnumber(2323);
  34. num3: isnumber(4/5);
  35. num4: isnumber("hello");
  36. col1: iscolor(red);
  37. col2: iscolor(hello);
  38. col3: iscolor(rgba(0,0,0,0.3));
  39. col4: iscolor(#fff);
  40. key1: iskeyword(hello);
  41. key2: iskeyword(3D);
  42. px1: ispixel(10px);
  43. px2: ispixel(10);
  44. per1: ispercentage(10%);
  45. per2: ispercentage(10);
  46. em1: isem(10em);
  47. em2: isem(10);
  48. ex1: extract(1 2 3 4, 2);
  49. ex2: extract(1 2, 1);
  50. ex3: extract(1, 1);
  51. @list: 1,2,3,4;
  52. ex4: extract(@list, 2);
  53. pow: pow(2,4);
  54. pi: pi();
  55. mod: mod(14,10);
  56. tan: tan(1);
  57. cos: cos(1);
  58. sin: sin(1);
  59. atan: atan(1);
  60. acos: acos(1);
  61. asin: asin(1);
  62. sqrt: sqrt(8);
  63. }
  64. #unit {
  65. @unit: "em";
  66. unit-lit: unit(10px);
  67. unit-arg: unit(10px, "s");
  68. unit-arg2: unit(10px, @unit);
  69. unit-math: unit(0.07407s) * 100%;
  70. }