Updated bar color algorithm