/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see .
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace WindowsFormsCalendar
{
///
/// Provides color information of calendar graphical elements
///
public class CalendarColorTable
{
#region Static
///
/// Returns the result of combining the specified colors
///
/// First color to combine
/// Second olor to combine
/// Average of both colors
public static Color Combine(Color c1, Color c2)
{
return Color.FromArgb(
(c1.R + c2.R) / 2,
(c1.G + c2.G) / 2,
(c1.B + c2.B) / 2
);
}
///
/// Converts the hex formatted color to a
///
///
///
public static Color FromHex(string hex)
{
if (hex.StartsWith("#"))
hex = hex.Substring(1);
if (hex.Length != 6) throw new Exception("Color not valid");
return Color.FromArgb(
int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber),
int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber));
}
#endregion
#region Colors
///
/// Background color of calendar
///
public Color Background = SystemColors.Control;
///
/// Background color of days in even months
///
public Color DayBackgroundEven = SystemColors.Control;
///
/// Background color of days in odd months
///
public Color DayBackgroundOdd = SystemColors.ControlLight;
///
/// Background color of selected days
///
public Color DayBackgroundSelected = SystemColors.Highlight;
///
/// Border of
///
public Color DayBorder = SystemColors.ControlDark;
///
/// Background color of day headers.
///
public Color DayHeaderBackground = Combine(SystemColors.ControlDark, SystemColors.Control);
///
/// Color of text of day headers
///
public Color DayHeaderText = SystemColors.GrayText;
///
/// Color of secondary text in headers
///
public Color DayHeaderSecondaryText = SystemColors.GrayText;
///
/// Color of border of the top part of the days
///
///
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
///
public Color DayTopBorder = SystemColors.ControlDark;
///
/// Color of border of the top parth of the days when selected
///
///
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
///
public Color DayTopSelectedBorder = SystemColors.ControlDark;
///
/// Background color of day tops.
///
///
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
///
public Color DayTopBackground = SystemColors.ControlLight;
///
/// Background color of selected day tops.
///
///
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
///
public Color DayTopSelectedBackground = SystemColors.Highlight;
///
/// Color of items borders
///
public Color ItemBorder = SystemColors.ControlText;
///
/// Background color of items
///
public Color ItemBackground = SystemColors.Window;
///
/// Forecolor of items
///
public Color ItemText = SystemColors.WindowText;
///
/// Color of secondary text on items (Dates and times)
///
public Color ItemSecondaryText = SystemColors.GrayText;
///
/// Color of items shadow
///
public Color ItemShadow = Color.FromArgb(50, Color.Black);
///
/// Color of items selected border
///
public Color ItemSelectedBorder = SystemColors.Highlight;
///
/// Background color of selected items
///
public Color ItemSelectedBackground = Combine(SystemColors.Highlight, SystemColors.HighlightText);
///
/// Forecolor of selected items
///
public Color ItemSelectedText = SystemColors.WindowText;
///
/// Background color of week headers
///
public Color WeekHeaderBackground = Combine(SystemColors.ControlDark, SystemColors.Control);
///
/// Border color of week headers
///
public Color WeekHeaderBorder = SystemColors.ControlDark;
///
/// Forecolor of week headers
///
public Color WeekHeaderText = SystemColors.ControlText;
///
/// Forecolor of day names
///
public Color WeekDayName = SystemColors.ControlText;
///
/// Border color of today day
///
public Color TodayBorder = Color.Orange;
///
/// Background color of today's DayTop
///
public Color TodayTopBackground = Color.Orange;
///
/// Color of lines in timescale
///
public Color TimeScaleLine = SystemColors.ControlDark;
///
/// Color of text representing hours on the timescale
///
public Color TimeScaleHours = SystemColors.GrayText;
///
/// Color of text representing minutes on the timescale
///
public Color TimeScaleMinutes = SystemColors.GrayText;
///
/// Background color of time units
///
public Color TimeUnitBackground = SystemColors.Control;
///
/// Background color of highlighted time units
///
public Color TimeUnitHighlightedBackground = Combine(SystemColors.Control, SystemColors.ControlLightLight);
///
/// Background color of selected time units
///
public Color TimeUnitSelectedBackground = SystemColors.Highlight;
///
/// Color of light border of time units
///
public Color TimeUnitBorderLight = SystemColors.ControlDark;
///
/// Color of dark border of time units
///
public Color TimeUnitBorderDark = SystemColors.ControlDarkDark;
///
/// Border color of the overflow indicators
///
public Color DayOverflowBorder = Color.White;
///
/// Background color of the overflow indicators
///
public Color DayOverflowBackground = SystemColors.ControlLight;
///
/// Background color of selected overflow indicators
///
public Color DayOverflowSelectedBackground = Color.Orange;
#endregion
}
}