Andrew Colclough

Web Design & Dev., Liberty, Economics, Football

Sublime: ...A Color Picker like Textmate?

Yeah, another feature that I (a CSS designer/dev) cannot live without. If you have no idea what I am talking about, here's the skinny:

Usually, as I am working on rapid development - I need to quickly pick colors - and test how they mesh with my design. Well, I don't know about you - but I don't do instant Hex or RGBa color conversions in my head too quickly. So, one of my favorite features of TextMate is the command "Insert Color" - Invoked by hitting Command+Shift+C. This launches the Apple color wheel picker that I use to adjust ranges of color -> which then spits out a Hex or RGBa value into my CSS code. 

Colorpicker

Sublime Text 2 doesn't have anything like this (as of yet...), and for me - that really could slow down my workflow. However - I found a decent solution until (or if) Sublime gets something like this. 

First: Nab the application version of the Apple Color Picker

This will allow you to keep open the color picker while you are working.

Second: Download and install either or both:

Colors

Simply drop these plugin files into Library > ColorPickers (create this dir/ if it doesn't exist). Then restart the Color Picker Application - and you have a way to easily grap Hex or RGBa values and dump them into Sublime. Win!

Note - Obviously, this is for OSX users. If you are on Windows, you will have to hunt around for windows variations of these little apps. 

Also - the TextMate command is just a ruby script...so if anyone has the know-how to convert it to something Sublime could understand...

Insertcolor
And if you had the same question I did about the above screenshot...

Burlywood

Filed under  //   Color Picker   Sublime Text 2   Textmate   burlywood   coding   css   hex   tips  

Behold - the awesome power of Sass Mixins

In case you missed this post, I have started using the Compass and Sass CSS frameworks on a new project. I wanted to share a little magical Sass action that I came across while working on a new site.

A Browser-wide Opacity Mixin

Probably the most outstanding feature of Sass is the ability to create "mixins." A mixin is nothing more than a small block of styling code that you create once - and then simply call out later (similar to calling a function in javascript). Sass' Mixin's can preform many actions that you would expect from a normal programming  language such as accepting parameters, variables, and even preforming those 'hard' maths. I happened to create a simple mixin that uses all three of these features to render a desired opacity across all browsers (hat-tip: Chris Coyier for the cross-browser opacity code). 

As Chris pointed out, each browser accepts opacity styles in a slightly different way. (I know, you're shocked...shocked!!) With regular CSS - you have two options: 

1) Create a .transparent_class and apply this to all html elements you wish to apply the opacity shift to. While this works, it is somewhat undesirable - because you are adding specific style information into your markup. In effect, to add/remove a design aspect you would need to alter your markup - when the ultimate goal is to separate the markup/structure from the style/design.

2) Apply all 4 opacity style rules to each individual element you select through CSS. This is technically better, but obviously a pain in the butt, and can really muck up your CSS. Unless you use a code editor such as Textmate which supports code snippets - you will be failing to keep your code DRY (Don't Repeat Yourself).  

As a side note, don't feel bad if you happen to use either of these methods. Coding ideals are just that: ideals. Coding ideals are often nice (though lofty) goals that will spare you headaches over time. However, in my experience - the difficulty and time involved coding rises exponentially the more rigidly you attempt to adhere to a coding ideal. 

But there is good news. The Sass Framework can greatly help in this department.

Here is the Sass Mixin I created for opacity:

Declaring the Mixin:

Mixin

Explanation:
The first line is the mixin name that you will refer to later, followed by the actual opacity parameter variable.
The next several lines are each of the 4 browser opacity style rule variations. Each one refers to the !opacity variable that you will pass the mixin. Because Internet Explorer takes the parameter in a different format (e.g. IE: 50, Others: 0.5 ) - I use a little simple math to calculate the value. Zing!

(By the way - the strange format is just one of the ways to write Sass code. You can read more about that on the Sass website.)

Calling the Mixin:

Mixincall

Explanation:
To call the mixin, all I have to do is add +opacity rule and pass the actual value I want inside the parentheses.  (note: the +shadow line is calling another mixin I created that accepts many parameters)

Sass code is then compiled to CSS (in this case, automatically by compass anytime I save a change) and adds...

filter: alpha(opacity= !opacity * 100); -moz-opacity: 0.7; -khtml-opacity: 0.7; opacity: 0.7;

...to the class .book-shadow, or anyplace else I call +opacity.

With Sass - it allows me to have the best of methods 1 and 2, which I mentioned above. I don't have to add design specific classes into my markup, as in method #1. Also - if I want a different opacity value, I don't have to create a separate .transparency_lighter_class, for example. I simply pass a different value. Sass also cuts out the suck of method #2, because I only have to repeat the one rule +opacity(howMuch) to any element.

Now - you do still end up with repetitive rules in your CSS files anytime you call +opacity - but you don't have to deal with them. Plus, Sass can be told to compile your CSS into a variety of modes, from expanded - to compact, which will trim down the size of your CSS, if you want it to.

Mixins are just one of the many great features of Sass. So far, my workflow has been greatly enhanced, and that's a Win in my book. 

Happy coding.

-Adc

Filed under  //   Chris Coyier   DRY   coding   compass   css   framework   mixin   opacity   sass   tips  

Don’t Use Black for Shadows | CSS-Tricks

That is, “don’t use black for shadows over colored backgrounds.” At every step of my design education I was taught this. For example, when adding a drop shadow as a layer style in Photoshop, don’t just pick a black or a gray but sample a color from the background, then dial it back in opacity until it looks good. This is because shadows in real life are not black. They are darkened versions of whatever they sit on top of, because there is less light. Check out this shadow. If you were trying to recreate that, I don’t think black at any opacity level would get it just right.

READ THE REST: css-tricks.com

Shadows are simply less light reflecting off of a color. Subtle but important thing you learn in art classes.

Filed under  //   art   black   colors   css   opacity   shadows   tip  

Compass: A Real Stylesheet Framework

I am currently testing this system out - and so far I have been totally blown away. I think Compass+Sass are a huge leap forward in the CSS arena. If you get the opportunity - watch this full video to get a good overview of some of the power that Compass and Sass could add to your web design/dev project.

Here are links to both Frameworks to get you started:
-Sass
-Compass

And as Samuel L. Jackson once said, "Hold on to your butts."

Filed under  //   blueprint   compass   compile   css   cutting-edge   framework   ruby   sass   web design   web developement  

Román Cortés » CSS 3D Meninas

Ok - you must click through the link below to see this CSS 3D awesomeness. It's worth it.

 

(versión en castellano abajo)

I’ve took the classic paint The Maids of Honour (Las Meninas) and made this CSS pseudo-3D/parallax effect. It is pure CSS, so no javascript or flash involved: only CSS and HTML code.

It has been tested and it is working on Internet Explorer 8, Firefox 3, Opera 9, Safari 3, Chrome 4 and Konqueror 3.5, and it validates.

Hat tip: Noonat

Filed under  //   3d   art   css   tricks  

Curious about CSS?

Mastering CSS Coding: Getting Started « Smashing Magazine
Media_httpmedia1smashingmagazinecomwpcontentuploads2009096bjpg_xjedigkgcwurewi

Whether you are a total n00b, or teh 7337 h4XX0rz - this is a great intro article covering most of the basics of Cascading Style Sheets.

Filed under  //   css   tips   web design   web developement