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
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
170
HTML5 APIs Confoo Montreal
drewm
1
250
PHP Payments with Omnipay
drewm
0
110
HTML5 APIs Confoo Vancouver
drewm
0
270
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
こんな時代だからこそ! 想定しておきたいアクセスキー漏洩後のムーブ
takuyay0ne
4
500
Flutter DevToolsで発見! 本番アプリのパフォーマンス問題と改善の実践
goto_tsl
1
120
ピープルウエア x スタートアップ
operando
3
3.8k
エンジニアにとってコードと並んで重要な「データ」のお話 - データが動くとコードが見える:関数型=データフロー入門
ismk
0
350
開発者が知っておきたい複雑さの正体/where-the-complexity-comes-from
hanhan1978
6
2.3k
AIと共に開発する時代の組織、プロセス設計 freeeでの実践から見えてきたこと
freee
2
250
Copilotの精度を上げる!カスタムプロンプト入門.pdf
ismk
10
3k
ユーザーストーリー x AI / User Stories x AI
oomatomo
0
120
ググるより、AIに聞こう - Don’t Google it, ask AI
oikon48
0
620
AIエージェントを導入する [ 社内ナレッジ活用編 ] / Implement AI agents
glidenote
1
340
よくわからない人向けの IAM Identity Center とちょっとした落とし穴
kazzpapa3
2
660
Datadog On-Call と Cloud SIEM で作る SOC 基盤
kuriyosh
0
110
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
960
Context Engineering - Making Every Token Count
addyosmani
8
360
Unsuck your backbone
ammeep
671
58k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
970
A Modern Web Designer's Workflow
chriscoyier
697
190k
A Tale of Four Properties
chriscoyier
161
23k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
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