0% found this document useful (0 votes)
2 views

Alex Kimu_ Computer Assignment_html

Uploaded by

keithkamphonje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Alex Kimu_ Computer Assignment_html

Uploaded by

keithkamphonje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

THECATHOLI

CUNI
VERSI
TYOFMALAWI

LI
LONGWESATELLI
TECENTRE

FACULTYOFEDUCATI
ON

PROGRAMME: DI
PLOMAI
NEDUCATI
ON

COURSETI
TTLE: WEBDESI
GN

COURSECODE: COMP2201

TO: MR.PHI
RI

FROM: ALEXKI
MU

REGNUMBER: DI
PMC/
2023/
3353

ASSI
GNMENT: 3WAYSOFHOW CANWEDEFI
NECOLORI
N HTMLDOCUMENT

DUEDATE: 13SEPTEMBER,
2024
I
nHTML,col or
scanbedef i
nedinseveralways,andunder
standi
ngthesemethods
al
lowsdevel
operstoenhancethevi
sualappealofwebpages.Herear
et hr
eepr
imary
methodsofdef
ini
ngcol
orinHTML:

1.Hexadeci
malCol
orCodes

Hexadecimal(hex)col
orcodesareoneoft hemostcommonway stodefinecol
orsin
HTML.Ahexcodei sasix-
digi
tcombinat
ionofnumbersandlet
ter
sprecededbya` #`
.
Thesesixdigi
tsrepr
esentt
heint
ensi
tyofred,gr
een,
andblue(
RGB)inacolor.

Hexadeci
mal
Col
orcodei
sst
ruct
uredasf
oll
ows:

 Hexcodest
art
swi
tha"
#"sy
mbol
fol
l
owedbysi
xchar
act
ers.

 Thef i
rsttwocharacter
sr epresenttheredcomponent
,thenextt
wor
epr
esent
green,andthef
inalt
wor epresentblue.

Forexampl
e:<pst
yle="
col
or:
#FF5733;
">Thi
sisapar
agr
aphwi
thhexcol
or.
</p>

Inthisexample,t
hehexcode` #FF5733`r
epresent
sashadeofor ange.Here’show i
t
breaksdown:FFrepresentst
heredcomponent,whi
chissett
o255( orful
lint
ensi
ty)
,57
represent
st hegreen component
,which i
ssett o 87,and 33 r
epresentstheblue
component ,
whichissetto51.

Insummar y,Hexcodesrangefr
om `00`(noi
ntensi
ty)t
o`FF`(
ful
lintensi
ty)
.This
method offer
s pr
eci
se cont
rolovercol
or,al
l
owing forov
er16 mi l
l
ion possi
ble
combinat
ions.

2.RGB(
Red,
Green,
Blue)Val
ues

Anotherwayt odefi
necolorinHTMListhrough**
RGB* *values,whi
chspeci
fythe
i
ntensit
yofred,gr
een,andbl
ueonascal
ef r
om 0to255.Thismet hodi
sbasedonthe
addi
tivecol
ormodel,
wherecol
orsar
ecr
eatedbycombini
ngtheset hr
eepr
imar
ycolor
s.

RGBcol
orsar
est
ruct
uredasf
oll
ows:

 RGBcol
orsar
edef
inedusi
ngt
he`
rgb(
)`f
unct
ion.

 The f unct
ion t
akes t
hree v
alues cor
respondi
ng t
ored,gr
een,and bl
ue,
respecti
vel
y .

Forexampl
e:<pst
yle="
col
or:
rgb(
255,
87,
51)
;"
>Thi
sisapar
agr
aphwi
thRGBcol
or.
</p>

I
nthi
sexampl
e:
 Ther
edcomponenti
s255(
ful
li
ntensi
ty)
.

 Thegr
eencomponenti
s87.

 Thebl
uecomponenti
s51.

I
nsummar
y,f
ort
heRGBv
alues:

 Eachcolorcomponent(
red,gr
een,andbl
ue)r
angesf
rom 0(
noi
ntensi
ty)t
o255
(f
ull
int
ensit
y).

 Unl
ikehexcodes,the`rgb(
)`funct
ionexpl
i
cit
lyl
i
stst
her
ed,gr
een,andbl
ue
component
sasseparat
ev al
ues.

 Thi
smet
hodal
l
owsf
orupt
o16,
777,
216col
orcombi
nat
ions(
256^
3).

3.Col
orNames

HTMLsupport
sasetofpr edef
inedcolornamesthatcanbeusedt
ospeci
fycol
ors.Thi
s
methodist
hesimplestandmosti ntuit
ive,asi
tall
owsyoutospeci
fycol
orsbyname
wi
thoutwor
ryi
ngaboutnumer i
cv al
uesorcodes.

Col
ornamesar
est
ruct
uredasf
oll
ows:

Col
orsar
edef
inedbysi
mpl
ywr
it
ingt
hei
rnames,
li
ker
ed,
blue,
green,
etc.

Forexampl
e:<pst
yle="
col
or:
red;
">Thi
sisapar
agr
aphwi
thanamedcol
or.
</p>

Inthisexample,theword"red"i
susedt osetthet extcolor.HTMLsuppor ts140
standar
dcolornames,i
ncl
udingcommoncolor
sli
keblue,gr een,y
ell
ow,pur
ple,orange
andmor especi
fi
cshadesl
ikeli
ght
gray
,dar
kbl
ueorfi
rebrick.

I
nsummar y,namedcolor
sar epredefi
ned,maki ngthem easytouseandunderstand
wit
houtneedi
ngtoremembernumer icvalues.Thismethodisusefulf
orbasi
cdesigns
whereawiderangeofcol
orsisn’
trequired.Thel i
stof140colornamesincl
udesboth
basi
ccolor
sandvari
ousshades.

Tosum upal l,thethreemethods—hexadeci


malcolorcodes,RGBv alues,andnamed
col
ors—provi
dedi ff
erentl
evel
sofcont r
olandsimpli
citywhendefini
ngcol orsi
nHTML
documents.Dependingont hecomplexi
tyofyourdesignandt helev
elofpr eci
siony
ou
need,youcanchooset hemet hodthatbestsuit
sy ourproject
.HexcodesandRGB
val
uesofferdetail
edcontr
olovercol
ors,whil
enamedcol orsareeasiertouseforbasic
needs.

You might also like