rn tonumber(r, 16), tonumber(g, 16), tonumber(b, 16), tonumber(a, 16)

  -- Then a colour override
  b, g, r = s\match '&H(%x%x)(%x%x)(%x%x)&'
  if b then
    return tonumber(r, 16), tonumber(g, 16), tonumber(b, 16), 0

  -- Then an alpha override
  a = s\match '&H(%x%x)&'
  if a then
    return 0, 0, 0, tonumber(a, 16)

  -- Ok how about HTML format then?
  r, g, b, a = s\match '#(%x%x)(%x?%x?)(%x?%x?)(%x?%<FILL-HERE>zero, make grey
  if S == 0
    r = clamp(V*255,
<fim-prefix>rn tonumber(r, 16), tonumber(g, 16), tonumber(b, 16), tonumber(a, 16)

  -- Then a colour override
  b, g, r = s\match '&H(%x%x)(%x%x)(%x%x)&'
  if b then
    return tonumber(r, 16), tonumber(g, 16), tonumber(b, 16), 0

  -- Then an alpha override
  a = s\match '&H(%x%x)&'
  if a then
    return 0, 0, 0, tonumber(a, 16)

  -- Ok how about HTML format then?
  r, g, b, a = s\match '#(%x%x)(%x?%x?)(%x?%x?)(%x?%<fim-suffix>zero, make grey
  if S == 0
    r = clamp(V*255,<fim-middle>x?)'
  if r then
    return tonumber(r, 16), tonumber(g, 16) or 0, tonumber(b, 16) or 0, tonumber(a, 16) or 0

-- Create an alpha override code from a style definition colour code
alpha_from_style = check'string' (scolor) -> ass_alpha select 4, extract_color scolor

-- Create an colour override code from a style definition colour code
color_from_style = check'string' (scolor) ->
  r, g, b = extract_color scolor
  ass_color r or 0, g or 0, b or 0

-- Converts HSV (Hue, Saturation, Value) to RGB
HSV_to_RGB = (H, S, V) ->
  r, g, b = 0, 0, 0

  -- Saturation is 
x?)&'
  if r then
    return tonumber(r, 16), tonumber(g, 16), tonumber(b, 16), tonumber(a, 16)

  -- Ok, now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (V-128)/128

  -- Now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (V-128)/128

  -- Now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (V-128)/128

  -- Now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (V-128)/128

  -- Now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (V-128)/128

  -- Now we have to do some math to get the colour
  r = (V-128)/128
  g = (V-128)/128
  b = (V-128)/128

  -- Now we have to do some math to get the alpha
  a = (