Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
77
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
120
HTML5 APIs Confoo Montreal
drewm
1
200
PHP Payments with Omnipay
drewm
0
94
HTML5 APIs Confoo Vancouver
drewm
0
210
Learn to Love Regular Expressions
drewm
0
78
Ecommerce Projects with Moltin
drewm
0
670
Writing Portable PHP
drewm
0
89
Getting to Grips with Regular Expressions
drewm
1
240
Back to Front Performance - Oct 2013
drewm
0
110
Other Decks in Technology
See All in Technology
Azureの基本的な権限管理の勉強会
yhana
1
2.1k
止まらないLinuxシステムを構築する_高信頼性クラスタ入門
koedoyoshida
1
320
リテール金融(キャッシュレス・ネット銀行・ネット証券)の競争環境と経済圏
8maki
0
1.6k
本当のAWS基礎
toru_kubota
1
630
JAWS-UG Bedrock Claude Night
yamahiro
3
710
コードや知識を組み込む / Incorporate Code and knowledge
ks91
PRO
0
150
web-application-security
matsuihidetoshi
1
190
R3のコードから見る実践LINQ実装最適化・コンカレントプログラミング実例
neuecc
3
2.5k
開発パフォーマンスを最大化するための開発体制
ham0215
7
1.1k
Microsoft for Startups Founders Hub_20240429 update
daikikanemitsu
1
2.4k
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
150
require(ESM)とECMAScript仕様
uhyo
4
970
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
21
1.9k
Learning to Love Humans: Emotional Interface Design
aarron
267
39k
Visualization
eitanlees
137
14k
How STYLIGHT went responsive
nonsquared
92
4.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
14
1.5k
Documentation Writing (for coders)
carmenintech
61
4k
The Language of Interfaces
destraynor
151
23k
Designing the Hi-DPI Web
ddemaree
276
33k
Building Better People: How to give real-time feedback that sticks.
wjessup
356
18k
How to name files
jennybc
65
93k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Web development in the modern age
philhawksworth
203
10k
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