{"id":193300,"date":"2013-09-11T13:52:03","date_gmt":"2013-09-11T09:52:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=193300"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=193300","title":{"rendered":"<span class=\"post_title\">Shade: \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0435\u043d\u0438 \u0442\u0440\u0435\u043d\u0434\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430 \u043d\u0430 CSS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 <a href=\"http:\/\/codepen.io\/hugo\/pen\/xzjGB\">\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 SCSS<\/a> \u0438 \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 LESS <s>\u0434\u0430 \u044f \u043b\u044e\u0431\u043b\u044e LESS \u0431\u043e\u043b\u044c\u0448\u0435<\/s>:<\/p>\n<p>  <a href=\"http:\/\/netcribe.com\/MojoShade\/\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/b76\/522\/4fb\/b765224fb1f54f4f20f971f33377da6a.png\" alt=\"lessshade\"\/><\/a><br \/>  <i>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 LESS 1.5.0, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 codepen \u0438\u043b\u0438 jsfiddle.<\/i><\/p>\n<pre><code> .shade(@type, @color, @depth, @angle, @long, @fade); <\/code><\/pre>\n<p>   <\/p>\n<ul>\n<li><b>type:<\/b> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f box\/text \u2014 box-shadow\/text-shadow <\/li>\n<li><b>color:<\/b> \u0446\u0432\u0435\u0442 \u0442\u0435\u043d\u0438<\/li>\n<li><b>depth:<\/b>\u0434\u043b\u0438\u043d\u0430 \u0442\u0435\u043d\u0438<\/li>\n<li><b>angle:<\/b> \u0443\u0433\u043e\u043b \u043d\u0430\u043a\u043b\u043e\u043d\u0430<\/li>\n<li><b>long:<\/b> boolean, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e true \u2014 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 Flat \u0442\u0435\u043d\u0438<\/li>\n<li><b>fade:<\/b> boolean, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044f false \u2014 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u0435<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code>#facebook {     .shade(box, #1B2733, 20, 135deg, true, false);     .shade(text, #253960, 50, 135deg, true, false);     background: #4161A2;     &:before {       content: &quot;\\e000&quot;;       } }  ...  #dribble {     .shade(box, #1B2733, 20, 135deg, true, false);     .shade(text, #9B2E58, 15, 135deg, false, false);     background: #C23B6F;     &:before {       content: &quot;\\e00f&quot;;       } } <\/code><\/pre>\n<h4>LESS 1.5.0<\/h4>\n<p>  Shade.less \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u00ab\u0447\u0438\u0441\u0442\u043e\u043c\u00bb LESS \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c JavaScript \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>    @shade: ~`(function (depth,x,y, ... thislightness) {         var shadow = &quot;&quot;;         for(var i=1; i&lt;depth; i++) {             if (i != depth) {                 shadow += i*x+&quot;px &quot;+i*y+&quot;px 0 hsla(&quot;+thishue+&quot;, &quot;+thissaturation+&quot;, &quot;+thislightness - (i*darken)+&quot;, &quot;+1 - (i * opacify)+&quot;), &quot;;             } else {                 shadow += i*x+&quot;px &quot;+i*y+&quot;px 0 hsla(&quot;+thishue+&quot;, &quot;+thissaturation+&quot;, &quot;+thislightness - (i*darken)+&quot;, &quot;+1 - (i * opacify)+&quot;);&quot;;              }         }         return shadow;     })(&quot;@{depth}&quot;, &quot;@{x}&quot;, &quot;@{y}&quot;, ... &quot;@{thislightness}&quot;)`; <\/code><\/pre>\n<p>   <\/div>\n<\/div>\n<p>  <\/p>\n<h5>\u041d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/less\/less.js\/blob\/master\/CHANGELOG.md\">1.5.0 Beta 1 (2013-09-01)<\/a><\/h5>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 source map (\u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u043e\u0441\u0442 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u0440\u043e \u044d\u0442\u043e <a href=\"http:\/\/habrahabr.ru\/post\/178743\/\">\u0437\u0434\u0435\u0441\u044c<\/a>)<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 <code>@import (inline) &quot;file.css&quot;;<\/code><\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Guard \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 min\/max<\/li>\n<li>\u041d\u043e\u0432\u044b\u0439 \u00ab\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439\u00bb \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u2014 <code>property+:<\/code> (\u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 shade.less, \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0443 += \u0432 JS):\n<pre><code>text-shadow+: (@i * @x) (@i * @y) 0 hsla(@hue, @sat, (@lightness - (@i * @darken)), (1 - (@i * @opacify)));         <\/code><\/pre>\n<p>   <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f svg-gradient<\/li>\n<li>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u043a\u0441\u043e\u0432<\/li>\n<\/ul>\n<h4>shade.less<\/h4>\n<pre><code>.shade(@type, @color: #3498db, @depth: 20, @angle: 135deg, @long: true, @fade: false) {     @ang: (@angle - 90deg);     @x: 1.5px * cos(@ang);     @y: 1.5px * sin(@ang);      .shade(@type, @color, @depth, @x, @y, @long, @fade, (lightness(@color)\/@depth)\/2, (alpha(@color)\/@depth)); }  \/* \u0415\u0441\u043b\u0438 \u0442\u0435\u043d\u044c&quot;\u0434\u043b\u0438\u043d\u0430\u044f&quot;, \u0442\u043e \u043e\u043d\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 *\/ .shade(@type, @color, @depth, @x, @y, @long, @fade, @darken, @opacify) when (@long = true) {      .shade(@type, @color, @depth, @x, @y, @fade, 0, @opacify); } \/* \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0441\u0432\u0435\u0442\u043b\u044f\u0435\u043c \u0442\u0435\u043d\u044c \u043e\u0442 \u043a\u043e\u043d\u0446\u0430 \u043a \u043d\u0430\u0447\u0430\u043b\u0443 *\/ .shade(@type, @color, @depth, @x, @y, @long, @fade, @darken, @opacify) when (@long = false) {      .shade(@type, @color, @depth, @x, @y, @fade, @darken, @opacify); \/\/  }  .shade(@type, @color, @depth, @x, @y, @long, @darken, @opacify) when (@fade = true) {     .shade(@type, @color, @depth, @x, @y, @darken, @opacify); } \/* \u0415\u0441\u043b\u0438 \u0442\u0435\u043d\u044c &quot;\u0434\u043b\u0438\u043d\u0430\u044f&quot; \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0431\u0435\u0437 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u044f *\/ .shade(@type, @color, @depth, @x, @y, @long, @darken, @opacify) when (@fade = false) {      .shade(@type, @color, @depth, @x, @y, @darken, 0); }  \/* \u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0446\u0432\u0435\u0442 \u043d\u0430 HSLA \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0437\u0430\u0434\u0430\u0432\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 http:\/\/habrahabr.ru\/qa\/46440\/ *\/ .shade(@type, @color, @depth, @x, @y, @darken, @opacify) {      @hue: hue(@color);     @sat: saturation(@color);     @lightness: lightness(@color);     .shade-recursive(@type, 1, @depth, @x, @y, @darken, @opacify, @hue, @sat, @lightness);   }  .shade-recursive(@type, @i, @depth, @x, @y, @darken, @opacify, @hue, @sat, @lightness) when (@i &lt; @depth) and (@type = text) {    text-shadow+: (@i * @x) (@i * @y) 0 hsla(@hue, @sat, (@lightness - (@i * @darken)), (1 - (@i * @opacify)));    .shade-recursive(@type, @i + 1, @depth, @x, @y, @darken, @opacify, @hue, @sat, @lightness); }  .shade-recursive(@type, @i, @depth, @x, @y, @darken, @opacify, @hue, @sat, @lightness) when (@i &lt; @depth) and (@type = box) {    box-shadow+: (@i * @x) (@i * @y) 0 hsla(@hue, @sat, (@lightness - (@i * @darken)), (1 - (@i * @opacify)));    .shade-recursive(@type, @i + 1, @depth, @x, @y, @darken, @opacify, @hue, @sat, @lightness); }          <\/code><\/pre>\n<p>  <a href=\"https:\/\/github.com\/Pestov\/Shade\">Github<\/a>.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u0432\u0430\u043c \u043f\u043b\u043e\u0441\u043a\u0438\u0445 \u0442\u0435\u043d\u0435\u0439.       \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/193300\/\"> http:\/\/habrahabr.ru\/post\/193300\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 <a href=\"http:\/\/codepen.io\/hugo\/pen\/xzjGB\">\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 SCSS<\/a> \u0438 \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 LESS <s>\u0434\u0430 \u044f \u043b\u044e\u0431\u043b\u044e LESS \u0431\u043e\u043b\u044c\u0448\u0435<\/s>:<\/p>\n<p>  <a href=\"http:\/\/netcribe.com\/MojoShade\/\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/b76\/522\/4fb\/b765224fb1f54f4f20f971f33377da6a.png\" alt=\"lessshade\"\/><\/a><br \/>  <i>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 LESS 1.5.0, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 codepen \u0438\u043b\u0438 jsfiddle.<\/i><\/p>\n<pre><code> .shade(@type, @color, @depth, @angle, @long, @fade); <\/code><\/pre>\n<p>   <\/p>\n<ul>\n<li><b>type:<\/b> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f box\/text \u2014 box-shadow\/text-shadow <\/li>\n<li><b>color:<\/b> \u0446\u0432\u0435\u0442 \u0442\u0435\u043d\u0438<\/li>\n<li><b>depth:<\/b>\u0434\u043b\u0438\u043d\u0430 \u0442\u0435\u043d\u0438<\/li>\n<li><b>angle:<\/b> \u0443\u0433\u043e\u043b \u043d\u0430\u043a\u043b\u043e\u043d\u0430<\/li>\n<li><b>long:<\/b> boolean, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e true \u2014 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 Flat \u0442\u0435\u043d\u0438<\/li>\n<li><b>fade:<\/b> boolean, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044f false \u2014 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-193300","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193300"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193300\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}