GenBrksCols <- function(var, nbrks = 21, digits = 2, 
                        color_fun = clim.colors) {
  if (!is.numeric(var)) {
    stop("Parameter 'var' must be numeric.")
  }
  varlim <- signif(c(min(var, na.rm = TRUE), max(var, na.rm = TRUE)), 4)
  if (!is.numeric(nbrks)) {
    stop("Parameter 'nbrks' must be an integer.")
  }
  nbrks <- round(nbrks)
  if (!is.numeric(digits)) {
    stop("Parameter 'digits' must be an integer.")
  }
  digits <- round(digits)

  brks <- round(seq(varlim[1], varlim[2], length.out = nbrks), digits)
  cols <- color_fun(nbrks - 1)
  list(brks = brks, cols = cols)
}
