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
89
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
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
120
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
260
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
450
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
Storage Browser for Amazon S3
miu_crescent
1
140
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
760
20241220_S3 tablesの使い方を検証してみた
handy
4
400
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Six Lessons from altMBA
skipperchong
27
3.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Visualization
eitanlees
146
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Done Done
chrislema
181
16k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Why Our Code Smells
bkeepers
PRO
335
57k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
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