<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>color Archives - rweber.net</title>
	<atom:link href="https://www.rweber.net/tag/color/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rweber.net/tag/color/</link>
	<description>trying to be a mile wide AND a mile deep</description>
	<lastBuildDate>Sun, 20 Jan 2019 03:18:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">37896774</site>	<item>
		<title>Non-Gray Grayscales</title>
		<link>https://www.rweber.net/projects/non-gray-grayscales/</link>
					<comments>https://www.rweber.net/projects/non-gray-grayscales/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 04 Feb 2019 13:00:58 +0000</pubDate>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Toys and Games]]></category>
		<category><![CDATA[color]]></category>
		<guid isPermaLink="false">https://www.rweber.net/?p=40693</guid>

					<description><![CDATA[<div><img width="300" height="177" src="https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-300x177.jpg" class="attachment-medium size-medium wp-post-image" alt="Colorful painted girl fading to black and white, image by Alexas_Fotos on Pixabay" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" fetchpriority="high" srcset="https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-300x177.jpg 300w, https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-150x88.jpg 150w, https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>If your darkest "neutral" is not gray, can you still generate a set of lighter shades that will work as neutrals? Presenting a utility I developed to do so.</p>
<p>The post <a href="https://www.rweber.net/projects/non-gray-grayscales/">Non-Gray Grayscales</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="177" src="https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-300x177.jpg" class="attachment-medium size-medium wp-post-image" alt="Colorful painted girl fading to black and white, image by Alexas_Fotos on Pixabay" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-300x177.jpg 300w, https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640-150x88.jpg 150w, https://www.rweber.net/wp-content/uploads/2019/01/girl-2848057_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Early this year, <a href="https://css-tricks.com/re-pleasing-color-palettes/">CSS-Tricks</a> linked to a page on <a href="https://refactoringui.com/previews/building-your-color-palette/">Refactoring UI about building a color palette</a>. They discuss problems with some common color palette selection options and ways you can get stuck with (or introduce technical debt fixing) problems from not having enough colors with enough distinct shades. They say &#8220;it&#8217;s not uncommon to need as many as ten different colors with 5-10 shades each for a complex UI.&#8221; That is, a scale of neutrals (white to very dark gray with other grays in between), a scale of your primary color, and a scale of each of several accent colors &#8211; at least one accent color is a must, but you may need more to give user feedback such as warnings versus errors, success messages, or information.</p>
<p>I got to thinking about the color scheme of this website, and another site I built recently which I had trouble picking colors for. What if you&#8217;d like your &#8220;neutral&#8221; scale not to be grays? The text on this site is brown; or technically, it&#8217;s a very dark red, #300. If I lighten it in 20% increments with the fantastic <a href="https://www.hexcolortool.com/">Hex Color Tool</a>, I get the following:</p>
<div style="display:flex;">
<div style="padding:6px;background-color:#300;width:20%;color:#fcc;">#300</div>
<div style="padding:6px;background-color:#633;width:20%;color:#fcc;">#633</div>
<div style="padding:6px;background-color:#966;width:20%;color:#fcc;">#966</div>
<div style="padding:6px;background-color:#c99;width:20%;">#C99</div>
<div style="padding:6px;background-color:#fcc;width:20%;">#FCC</div>
</div>
<p>This is not leading to a usable &#8220;neutral&#8221; scale; a pale pink is simply not interchangeable with a light gray.</p>
<p>However, what if you simultaneously lightened and desaturated your initial color? Would that work? My first attempt converted the color to HSL, divided the distance between the saturation and 0 and between the lightness and 1 into equal pieces, and stepped them both simultaneously. To my surprise, while the lightest colors are certainly more usable as a neutral scale than the RGB lightening, the intermediate ones are significantly more saturated.</p>
<div style="display:flex;">
<div style="padding:6px;width:20%;color:#DAC8C8;background-color:#330000;">#330000</div>
<div style="padding:6px;width:20%;color:#DAC8C8;background-color:#810E0E;">#810E0E</div>
<div style="padding:6px;width:20%;color:#DAC8C8;background-color:#BC2F2F;">#BC2F2F</div>
<div style="padding:6px;width:20%;background-color:#C87E7E;">#C87E7E</div>
<div style="padding:6px;width:20%;background-color:#DAC8C8;">#DAC8C8</div>
</div>
<p>For a second try, I exponentially decayed the saturation, using the points <code>(0, initial_saturation)</code> and <code>(final_shade_step, 0.05)</code> to define the equation. That 0.05 was done by feel &#8212; I started with 0.001 and my brown grayed out <strong>way</strong> too fast; 0.01 was still too fast, but 0.1 seemed too slow. I went back and forth between 0.075 and 0.05 but ultimately the latter seemed better for a wider variety of starting colors.</p>
<div style="display:flex;">
<div style="padding:6px;width:20%;color:#D5CDCD;background-color:#330000;">#330000</div>
<div style="padding:6px;width:20%;color:#D5CDCD;background-color:#6F2020;">#6F2020</div>
<div style="padding:6px;width:20%;color:#D5CDCD;background-color:#995252;">#995252</div>
<div style="padding:6px;width:20%;background-color:#B29494;">#B29494</div>
<div style="padding:6px;width:20%;background-color:#D5CDCD;">#D5CDCD</div>
</div>
<p>It&#8217;s still not quite as desaturated as the plain hex lightening in the intermediate colors, but it&#8217;s more comparable and still a big improvement in the lightest colors.</p>
<p>When I tested my code, I found it worked great for fairly saturated starting colors. For less-saturated starts, though, the colors weren&#8217;t great OR my equation fell apart entirely and spat back junk. I could fix the latter with some min/max checks, but that was suboptimal &#8211; keeping the same saturation level throughout the scale. Instead, for starting colors where the saturation is under 55%, the saturation value at the final shade step is computed as 0.01 of the starting saturation value. That works much better. For example, taking a 50% saturated dark blue-green&#8230;</p>
<p>Min-max checks in place, but using same equation as above:</p>
<div style="display:flex;">
<div style="padding:6px;width:20%;color:#C5E9BE;background-color:#193913;">#193913</div>
<div style="padding:6px;width:20%;color:#C5E9BE;background-color:#367A29;">#367A29</div>
<div style="padding:6px;width:20%;color:#C5E9BE;background-color:#52BB3E;">#52BB3E</div>
<div style="padding:6px;width:20%;background-color:#8BD47D;">#8BD47D</div>
<div style="padding:6px;width:20%;background-color:#C5E9BE;">#C5E9BE</div>
</div>
<p>With the adjusted equation:</p>
<div style="display:flex;">
<div style="padding:6px;width:20%;color:#D0D9CF;background-color:#193913;">#193913</div>
<div style="padding:6px;width:20%;color:#D0D9CF;background-color:#3E6E35;">#3E6E35</div>
<div style="padding:6px;width:20%;color:#D0D9CF;background-color:#689B5F;">#689B5F</div>
<div style="padding:6px;width:20%;background-color:#9EB79A;">#9EB79A</div>
<div style="padding:6px;width:20%;background-color:#D0D9CF;">#D0D9CF</div>
</div>
<p>I added a similar cutoff point at 35% saturation, dropping the constant down to 0.001, although at that point the linear equation works quite well.</p>
<p>After all that, do you want to play?</p>
<h3 id="cns-embed">&#8220;Colorful Neutral&#8221; Color Scale Generator</h3>
<div id="cns-container" class="cns-container">
</div>
<p><script src="https://www.rweber.net/wp-content/uploads/2019/01/cns.js"></script></p>
<p>If you would like to peek or fool around with it, the code for this can be found in <a href="https://github.com/ReveWeber/colorful-neutral-scale">my GitHub colorful-neutral-scale repository</a>.</p>
<hr>
<p><small>Fade to black and white image by <a href="https://pixabay.com/en/girl-color-black-and-white-brush-2848057/">Alexas_Fotos on Pixabay</a>.</small></p>
<p>The post <a href="https://www.rweber.net/projects/non-gray-grayscales/">Non-Gray Grayscales</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/projects/non-gray-grayscales/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">40693</post-id>	</item>
		<item>
		<title>Return of the Color Scheme Picker</title>
		<link>https://www.rweber.net/toys-and-games/return-color-scheme-picker/</link>
					<comments>https://www.rweber.net/toys-and-games/return-color-scheme-picker/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 11 Jul 2016 12:00:19 +0000</pubDate>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Toys and Games]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[portfolio]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39924</guid>

					<description><![CDATA[<div><img width="204" height="300" src="https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-204x300.png" class="attachment-medium size-medium wp-post-image" alt="color scheme picker featuring the new additions" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-204x300.png 204w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-768x1127.png 768w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds.png 698w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-102x150.png 102w" sizes="(max-width: 204px) 100vw, 204px" /></div>
<p>A new edition: now select up to five colors and have them highlighted and previewed below the options grid.</p>
<p>The post <a href="https://www.rweber.net/toys-and-games/return-color-scheme-picker/">Return of the Color Scheme Picker</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="204" height="300" src="https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-204x300.png" class="attachment-medium size-medium wp-post-image" alt="color scheme picker featuring the new additions" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-204x300.png 204w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-768x1127.png 768w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds.png 698w, https://www.rweber.net/wp-content/uploads/2016/07/color-preview-backgrounds-102x150.png 102w" sizes="auto, (max-width: 204px) 100vw, 204px" /></div><p>I got back to this sooner than I thought &#8211; and good thing, too, since I found a bug dating clear back to my <a href="https://www.rweber.net/web-development/javascript/flattening-color-layers-javascript/">color layer flattener</a> (not accounting for leading zeroes when converting to a hex string is a lot more noticeable once you are doing something with said hex string besides displaying it). You can read about the idea behind this in the <a href="https://www.rweber.net/web-development/javascript/color-scheme-picker-take-1/">previous color scheme picker post</a>.</p>
<p>You can now select up to five colors from the grid of fifteen and have those colors show as the highlight on the corresponding hex code and in boxes below against black and white backgrounds. You can actually select more than five but only the first five (left to right, top to bottom in the grid) will show up below. Have fun!</p>
<div id="csp-container" style="clear:left;" data-path="wp-content/uploads/2016/07">[visit my blog to see the picker in action]</div>
<p><script type="text/javascript" src="/wp-content/uploads/2016/07/jscsp-no-jquery.js"></script></p>
<p>Up-to-date code is available in the <a href="https://github.com/ReveWeber/color-scheme-picker">GitHub repo</a>. Thanks again to <a href="https://github.com/bgrins/spectrum">Brian Grinstead</a> and <a href="https://github.com/davidmerfield/randomColor">David Merfield</a> for the color utilities they&#8217;ve written and made freely available.</p>
<p>The post <a href="https://www.rweber.net/toys-and-games/return-color-scheme-picker/">Return of the Color Scheme Picker</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/toys-and-games/return-color-scheme-picker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">39924</post-id>	</item>
		<item>
		<title>A color scheme picker, take 1</title>
		<link>https://www.rweber.net/projects/color-scheme-picker-take-1/</link>
					<comments>https://www.rweber.net/projects/color-scheme-picker-take-1/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 23 May 2016 12:00:21 +0000</pubDate>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[color]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39873</guid>

					<description><![CDATA[<div><img width="300" height="180" src="https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-300x180.jpg" class="attachment-medium size-medium wp-post-image" alt="collage of color schemes generated with my interactive utility" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-300x180.jpg 300w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-768x461.jpg 768w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-150x90.jpg 150w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage.jpg 1000w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div>
<p>A non-Photoshop way to create unified color schemes with tints and shades - or just a fun little toy utility.</p>
<p>The post <a href="https://www.rweber.net/projects/color-scheme-picker-take-1/">A color scheme picker, take 1</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="180" src="https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-300x180.jpg" class="attachment-medium size-medium wp-post-image" alt="collage of color schemes generated with my interactive utility" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-300x180.jpg 300w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-768x461.jpg 768w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage-150x90.jpg 150w, https://www.rweber.net/wp-content/uploads/2016/05/color-scheme-collage.jpg 1000w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div><p>After my <a href="https://www.rweber.net/web-development/javascript/flattening-color-layers-javascript/">JS Color Layer Flattener</a> and research for <a href="https://www.rweber.net/web-development/css/web-design-non-designer/">Web Design for the Non-Designer</a>, I decided to implement the color scheme selection process outlined in WebdesignerDepot&#8217;s article <a href="http://www.webdesignerdepot.com/2009/12/how-to-get-a-professional-look-with-color/">How to Get a Professional Look With Color</a>: choose up to five colors; increase to fifteen by adding the result of overlaying each color with translucent black or white; unify the fifteen by overlaying all with a common translucent color. Instead of manual input like the layer flattener, I went with Brian Grinstead&#8217;s color picker <a href="https://github.com/bgrins/spectrum">Spectrum</a>, except for the black and white layers. The colors populate on load via David Merfield&#8217;s <a href="https://github.com/davidmerfield/randomColor">Random Color</a> script, something I pinned a while ago but never used. I do use the blending part of my <a href="https://github.com/ReveWeber/js-color-layer-flattener">color layer flattener</a> to compute hex values for the fifteen resulting colors.</p>
<p>Try it out!</p>
<div id="csp-container" data-path="wp-content/uploads/2016/05">[visit my blog to see the picker in action]</div>
<p><script type="text/javascript" src="/wp-content/uploads/2016/05/jscsp-no-jquery.js"></script></p>
<p>To use it yourself there are two pieces you need: jscsp-form.html and either jscsp-complete.js or jscsp-no-jquery.js. The form includes Spectrum&#8217;s CSS and both the scripts include both Spectrum and Random Color; jscsp-complete.js includes jQuery, as you might guess, so use jscsp-no-jquery.js if your site already loads jQuery. At the moment the <a href="https://github.com/ReveWeber/color-scheme-picker">GitHub repo for this</a> is slightly behind CSS-wise but not functionality-wise.</p>
<p>To use: place a div with <code>id="csp-container"</code> in your page. If the file jscsp-form.html is not at the root of your webpage, assign the container div a data-path attribute with the URL between the domain and jscsp-form.html. For example, for <code>example.com/gadgets/color/jscsp-form.html</code> you would use <code>data-path="gadgets/color"</code>. Including or excluding slashes on each end is okay. Call jscsp-complete.js or jscsp-no-jquery.js sometime after the container div.</p>
<p>My intention is to come back to this and add a means to select, say, five of the fifteen resultant colors and have them appear by themselves underneath the current contents, perhaps against both black and white backgrounds.</p>
<p>The post <a href="https://www.rweber.net/projects/color-scheme-picker-take-1/">A color scheme picker, take 1</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/projects/color-scheme-picker-take-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">39873</post-id>	</item>
		<item>
		<title>Flattening Color Layers with JavaScript</title>
		<link>https://www.rweber.net/projects/flattening-color-layers-javascript/</link>
					<comments>https://www.rweber.net/projects/flattening-color-layers-javascript/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 16 May 2016 12:00:17 +0000</pubDate>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Toys and Games]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[portfolio]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39671</guid>

					<description><![CDATA[<div><img width="225" height="300" src="https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-225x300.jpg" class="attachment-medium size-medium wp-post-image" alt="Rainbow Cake (both cake and photo) by Dabbisch on Deviantart [CC BY-NC-ND 3.0]" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-225x300.jpg 225w, https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink.jpg 768w, https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-112x150.jpg 112w" sizes="auto, (max-width: 225px) 100vw, 225px" /></div>
<p>I wrote a little JavaScript program to calculate the displayed color when up to two translucent layers are displayed on an opaque background. It's a toy, but a fun one!</p>
<p>The post <a href="https://www.rweber.net/projects/flattening-color-layers-javascript/">Flattening Color Layers with JavaScript</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="225" height="300" src="https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-225x300.jpg" class="attachment-medium size-medium wp-post-image" alt="Rainbow Cake (both cake and photo) by Dabbisch on Deviantart [CC BY-NC-ND 3.0]" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-225x300.jpg 225w, https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink.jpg 768w, https://www.rweber.net/wp-content/uploads/2016/04/rainbow_cake_by_dabbisch-d5gbink-112x150.jpg 112w" sizes="auto, (max-width: 225px) 100vw, 225px" /></div><p>A while ago I was trying to find an appropriate opaque fallback color for a translucent background color. Although after some thought I understand what the method is to calculate such a thing, at the time I just did a search and came across <a href="https://www.viget.com/articles/equating-color-and-transparency">an article by Lance Gutin relating transparency and color for grayscale</a>. I thought I might expand it to full-color, and after little time on the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/">Mozilla Development Network</a> and a lot in <a href="http://stackoverflow.com/">Stack Overflow</a> and <a href="http://brackets.io/">Brackets</a>, I have a little utility for you. You can use it here or <a href="https://github.com/ReveWeber/js-color-layer-flattener">grab it on GitHub.</a></p>
<div id="jsclf-container" data-path="wp-content/uploads/2016/04" style="clear:left;"></div>
<p><script type="text/javascript" src="/wp-content/uploads/2016/04/jsclf.js"></script></p>
<p>Since the arithmetic turned out to be straightforward and my need for this sort of calculation is infrequent, this project turned more into a way to practice non-DOM-manipulation and plain-vanilla JavaScript. My goal was for any valid color specification syntax to be acceptable, and maybe for it to be even more forgiving than that. I found the MDN pages on <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">the color CSS data type</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expressions in JavaScript</a> most helpful.</p>
<h3>Mathity Math</h3>
<p>The simplest calculation is on an opaque background, where you take a weighted average of the color values. If the alpha of your overlay color is set to 0.8, to find the red value of the color you see (the composite color), you&#8217;ll calculate <code>0.8*(red value of overlay) + (1 - 0.8)*(red value of background)</code>. Do that for all three color channels and you have the code for the composite color. You can make this calculation for some opacities via the <a href="http://meyerweb.com/eric/tools/color-blend/#:::hex">Color Blender from Eric Meyer</a> (opacity must be a fraction with denominator less than or equal to 11).</p>
<p>When you add translucency as an option for the background the arithmetic increases in length but not really in complexity: <a href="https://www.w3.org/TR/2003/REC-SVG11-20030114/masking.html#SimpleAlphaBlending">the spec for simple alpha blending or compositing</a> (which applies to both SVG and CSS) simply takes a doubly-weighted average, though it does not take the color underneath the background into account.</p>
<p>Here&#8217;s the fully written out calculation, for the red channel:<br />
<code>(composite alpha)*(composite red) = (1 - overlay alpha)*(background alpha)*(background red) + (overlay alpha)*(overlay red)</code><br />
The composite color&#8217;s alpha value will be <code>1 - (1 - overlay alpha)*(1 - background alpha)</code>. If either background or overlay is opaque, the composite will be opaque. If the background is opaque the equation simplifies to the one we had previously; if the overlay is opaque it simplifies to <code>composite red = overlay red</code>.</p>
<p>A translucent background on an opaque bottom layer (the tallest stack I was interested in manipulating) can be dealt with in two steps: average the background and the bottom layer and then average that with the overlay.</p>
<p>Turns out that calculation is the simplest of the bunch, though, and extracting the color information from the assorted kinds of input permitted is much more complicated. I&#8217;ll leave that story to the code itself, though.</p>
<hr>
<p><small>Rainbow Cake (both cake and photo) by <a href="http://dabbisch.deviantart.com/art/Rainbow-Cake-329742128">Dabbisch on Deviantart</a> [<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>].</small></p>
<p>The post <a href="https://www.rweber.net/projects/flattening-color-layers-javascript/">Flattening Color Layers with JavaScript</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/projects/flattening-color-layers-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">39671</post-id>	</item>
		<item>
		<title>Web Design for the Non-Designer</title>
		<link>https://www.rweber.net/design/web-design-non-designer/</link>
					<comments>https://www.rweber.net/design/web-design-non-designer/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 18 Apr 2016 12:00:58 +0000</pubDate>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[website layout]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39709</guid>

					<description><![CDATA[<div><img width="300" height="200" src="https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280-300x200.jpg" class="attachment-medium size-medium wp-post-image" alt="photo of pencil and ruler on blueprints" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280-300x200.jpg 300w, https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280-768x512.jpg 768w, https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280-1024x682.jpg 1024w, https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280-150x100.jpg 150w, https://www.rweber.net/wp-content/uploads/2016/04/blueprint-964629_1280.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div>
<p>I'm a developer, not a designer. I've spent a lot of time in search of simple rules of thumb for design, from page layout to button styling, and I'd like to share the findings.</p>
<p>The post <a href="https://www.rweber.net/design/web-design-non-designer/">Web Design for the Non-Designer</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
			<error>
    <code>internal_server_error</code>
    <title><![CDATA[WordPress &amp;rsaquo; Error]]></title>
    <message><![CDATA[&lt;p&gt;There has been a critical error on this website.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://wordpress.org/documentation/article/faq-troubleshooting/&quot;&gt;Learn more about troubleshooting WordPress.&lt;/a&gt;&lt;/p&gt;]]></message>
    <data>
        <status>500</status>
    </data>
</error>
