GenBrksCols <- function(var, ncolors = 20, 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(ncolors)) {
    stop("Parameter 'ncolors' must be an integer.")
  }
  ncolors <- round(ncolors)
  if (!is.numeric(digits)) {
    stop("Parameter 'digits' must be an integer.")
  }
  digits <- round(digits)

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