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
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Using RGBA Colour The Bagpuss Way
From Oxford Geek Night.
Drew McLellan
September 27, 2011
More Decks by Drew McLellan
See All by Drew McLellan
HTML5 APIs PHP Yorkshire 2017
drewm
1
220
HTML5 APIs Confoo Montreal
drewm
1
280
PHP Payments with Omnipay
drewm
0
130
HTML5 APIs Confoo Vancouver
drewm
0
300
Learn to Love Regular Expressions
drewm
0
180
Ecommerce Projects with Moltin
drewm
0
700
Writing Portable PHP
drewm
0
140
Getting to Grips with Regular Expressions
drewm
1
290
Back to Front Performance - Oct 2013
drewm
0
130
Other Decks in Technology
See All in Technology
AWS Blocks を触ってみた/first-tach-aws-blocks
fossamagna
2
150
Claude Codeとハーネスについて考えてみる
oikon48
18
9.1k
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
13
2k
cccccc
moznion
0
1.9k
Zoom2Youtube.Claude
kawaguti
PRO
3
490
Making sense of Google’s agentic dev tools
glaforge
1
130
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
220
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
2
160
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
370
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
3.2k
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
0
120
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
4.6k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3.1k
WCS-LA-2024
lcolladotor
0
680
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Into the Great Unknown - MozCon
thekraken
41
2.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
A Modern Web Designer's Workflow
chriscoyier
698
190k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
380
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
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