lw_common.ui.note_ctrl.add_color_for_author C# (CSharp) Method

add_color_for_author() private method

private add_color_for_author ( string author_name, Color default_color ) : void
author_name string
default_color Color
return void
        private void add_color_for_author(string author_name, Color default_color) {
            if (author_colors_.ContainsKey(author_name))
                // already have it
                return;

            // these are the colors that are not used by existing authors at this point
            List<Color> new_colors = default_author_colors_.Where(x => x.ToArgb() != author_color_.ToArgb() && !author_colors_.Values.Contains(x) ).ToList();

            if (new_colors.Count > 0) {
                author_colors_.Add(author_name, new_colors[0]);
            } else 
                // at this point - way too many authors - we don't have enough colors - just use what he originally set
                author_colors_.Add(author_name, default_color);
        }