$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using RGBA Colour The Bagpuss Way
Search
Drew McLellan
September 27, 2011
Technology
1
100
Using RGBA Colour The Bagpuss Way
From Oxford Geek Night.
Drew McLellan
September 27, 2011
Tweet
Share
More Decks by Drew McLellan
See All by Drew McLellan
HTML5 APIs PHP Yorkshire 2017
drewm
1
180
HTML5 APIs Confoo Montreal
drewm
1
260
PHP Payments with Omnipay
drewm
0
110
HTML5 APIs Confoo Vancouver
drewm
0
280
Learn to Love Regular Expressions
drewm
0
150
Ecommerce Projects with Moltin
drewm
0
690
Writing Portable PHP
drewm
0
120
Getting to Grips with Regular Expressions
drewm
1
270
Back to Front Performance - Oct 2013
drewm
0
130
Other Decks in Technology
See All in Technology
形式手法特論:CEGAR を用いたモデル検査の状態空間削減 #kernelvm / Kernel VM Study Hokuriku Part 8
ytaka23
1
120
AIにおける自由の追求
shujisado
3
470
Microsoft Agent 365 を 30 分でなんとなく理解する
skmkzyk
1
280
Ryzen NPUにおけるAI Engineプログラミング
anjn
0
210
あなたの知らないDateのひみつ / The Secret of "Date" You Haven't known #tqrk16
expajp
0
110
Databricksによるエージェント構築
taka_aki
1
110
私のRails開発環境
yahonda
0
180
「え?!それ今ではHTMLだけでできるの!?」驚きの進化を遂げたモダンHTML
riyaamemiya
10
4.4k
タグ付きユニオン型を便利に使うテクニックとその注意点
uhyo
2
610
M5UnifiedとPicoRubyで楽しむM5シリーズ
kishima
0
110
HIG学習用スライド
yuukiw00w
0
110
オープンデータの内製化から分かったGISデータを巡る行政の課題
naokim84
2
1.3k
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
The Invisible Side of Design
smashingmag
302
51k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
GraphQLとの向き合い方2022年版
quramy
49
14k
The Language of Interfaces
destraynor
162
25k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Music & Morning Musume
bryan
46
7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Transcript
Using RGBA Colour The Bagpuss Way Oxford Geek Night 10
- 21 January 2009 Drew McLellan, edgeofmyseat.com
There are lots of different ways to specify colours in
CSS
fuchsia #FF00FF #F0F rgb(255, 0, 255) rgb(100%, 0, 100%)
However you write it, they’re identical colours. (it’s all the
same biscuit)
They all have one other important aspect in common.
These all specify solid colours.
CSS3 introduces rgba()
Red Green Blue Alpha (opacity)
rgba(255, 255, 255, 0.5)
rgba(255, 255, 255, 0.5)
But that’s what CSS3 opacity does isn’t it?
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
Opacity affects the entire object Hello world Hello world
RGBA is about the opacity of a colour Hello world
Hello world Hello world
Pink stripes 100% opacity
Entire Bagpuss 50% opacity
Pink stripes 50% opacity, as nature intended
Closer to a tiled, flat colour semi-transparent PNG, without the
image.
... but also works for text, borders, foregrounds, backgrounds, playgrounds.
(maybe not playgrounds)
How?
rgba(255, 255, 255, 0.5)
Browser support is ok, but not great.
Firefox 3 Safari 3 Opera 10
So how can we use this today without ending up
with a nasty old mess in rubbish old browsers that don’t support all this lovely RGBA stuff?
None
Fall back to solid colour background: rgb(187, 192, 187); background:
rgba(120, 130, 120, 0.5);
Fall back to alpha PNG background: transparent url(green50.png); background: rgba(120,
130, 120, 0.5) none;
Tell me more! http://allinthehead.com/code/rgba/ http://dorward.me.uk/www/css/alpha-colour/
allinthehead.com/presentations Thank you. twitter.com/drewm