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
91
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
140
HTML5 APIs Confoo Montreal
drewm
1
210
PHP Payments with Omnipay
drewm
0
100
HTML5 APIs Confoo Vancouver
drewm
0
250
Learn to Love Regular Expressions
drewm
0
110
Ecommerce Projects with Moltin
drewm
0
680
Writing Portable PHP
drewm
0
96
Getting to Grips with Regular Expressions
drewm
1
250
Back to Front Performance - Oct 2013
drewm
0
120
Other Decks in Technology
See All in Technology
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
170
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
3.4k
2024AWSで個人的にアツかったアップデート
nagisa53
1
110
コロプラのオンボーディングを採用から語りたい
colopl
5
1.2k
dbtを中心にして組織のアジリティとガバナンスのトレードオンを考えてみた
gappy50
0
240
AWSの生成AIサービス Amazon Bedrock入門!(2025年1月版)
minorun365
PRO
7
470
ABWGのRe:Cap!
hm5ug
1
120
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
670
Docker Desktop で Docker を始めよう
zembutsu
PRO
0
160
AWS re:Invent 2024 recap in 20min / JAWSUG 千葉 2025.1.14
shimy
1
100
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
150
Featured
See All Featured
Designing for Performance
lara
604
68k
Git: the NoSQL Database
bkeepers
PRO
427
64k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
BBQ
matthewcrist
85
9.4k
Bash Introduction
62gerente
610
210k
Scaling GitHub
holman
459
140k
A designer walks into a library…
pauljervisheath
205
24k
Embracing the Ebb and Flow
colly
84
4.5k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Building Applications with DynamoDB
mza
93
6.2k
Side Projects
sachag
452
42k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
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