在ng-datepicker中设置颜色

时间:2018-10-29 14:27:03

标签: css angular datepicker

我要设置有效日期的背景色。默认值为蓝色,我想将其设置为绿色。知道我该如何实现吗?

我在下面使用日期选择器:

Library

enter image description here

这是我的代码:

html:

 <ng-datepicker [options]=option [(ngModel)]="date"></ng-datepicker>

ts:

 this.option = {
  minYear: 1970,
  maxYear: 2050,
  displayFormat: 'MM.DD.YYYY',
  barTitleFormat: 'MMMM YYYY',
  dayNamesFormat: 'dd',
  firstCalendarDay: 1, // 0 - Sunday, 1 - Monday
  locale: deLocale,
  //minDate: new Date(Date.now()), // Minimal selectable date
  //maxDate: new Date(Date.now()),  // Maximal selectable date
  barTitleIfEmpty: 'Wähle ein Datum aus',
  placeholder: 'Wähle ein Datum aus', // HTML input placeholder attribute (default: '')
  addStyle: {
  }, // Optional, value to pass to [ngStyle] on the input field
  fieldId: 'my-date-picker', // ID to assign to the input field. Defaults to datepicker-<counter>
  useEmptyBarTitle: false, // Defaults to true. If set to false then barTitleIfEmpty will be disregarded and a date will always be shown 
};

1 个答案:

答案 0 :(得分:0)

在组件的CSS中添加以下内容将使当天的背景为绿色

span.day-unit.is-today.is-selected {
    background-color: green !important;
}