Write below code:-
Import System.Drawing Namespace at the top of .VB page
Imports System.Drawing
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Write(ConvertColorCodeToHexColor(Color.Pink)+ "<br/>")
Response.Write(ConvertColorCodeToHexColor(Color.Blue)+ "<br/>")
Response.Write(ConvertColorCodeToHexColor(Color.Red)+ "<br/>")
Response.Write(ConvertColorCodeToHexColor(Color.Yellow)+ "<br/>")
End Sub
Function ConvertColorCodeToHexColor(ByVal clr As Color) As String
Return "#" + clr.ToArgb().ToString("x").Substring(2)
End Function
Output:-
#ffc0cb
#0000ff
#ff0000
#ffff00So,we can convert any Color into their Hex Value.