removeElementScrollColors function

List<String>? removeElementScrollColors(
  1. Element element
)

Removes element scroll colors CSS properties set by setElementScrollColors.

Implementation

List<String>? removeElementScrollColors(Element element) {
  element.style?.removeProperty('scrollbar-width');
  element.style?.removeProperty('scrollbar-color');

  var scrollClassIDs = element.classList
      .toIterable()
      .where((c) => c.startsWith('__scroll_color__'))
      .toList();

  if (isNotEmptyObject(scrollClassIDs)) {
    element.classList.removeAll(scrollClassIDs);
    return scrollClassIDs;
  } else {
    return null;
  }
}