﻿custom_map_mode_initialize = { # we don't want or need a constant update of this map
    # effect = {
    #     set_global_variable = {
    #         name = custom_map_mode
    #         value = flag:none
    #     }
    #     siro_e_map_barony = yes
    # }
    # is_valid = {
    #     has_global_variable = custom_map_mode
    #     NOT = { global_var:custom_map_mode = flag:none  }
    # }
}

minorities_map = {
    effect = {
        every_county = {
            if = {
                limit = {
                    has_variable_list = faith_minorities_large
                    variable_list_size = {
                        name = faith_minorities_large
                        value > 0
                    }
                    has_variable_list = culture_minorities_large
                    variable_list_size = {
                        name = culture_minorities_large
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_large
                            value > 1
                        }
                        variable_list_size = {
                            name = culture_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = neg_8 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = neg_7 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = neg_6 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = neg_5 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = faith_minorities_large
                    variable_list_size = {
                        name = faith_minorities_large
                        value > 0
                    }
                    has_variable_list = culture_minorities_small
                    variable_list_size = {
                        name = culture_minorities_small
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_large
                            value > 1
                        }
                        variable_list_size = {
                            name = culture_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 22 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 21 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 20 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 19 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = faith_minorities_small
                    variable_list_size = {
                        name = faith_minorities_small
                        value > 0
                    }
                    has_variable_list = culture_minorities_large
                    variable_list_size = {
                        name = culture_minorities_large
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_small
                            value > 1
                        }
                        variable_list_size = {
                            name = culture_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 18 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 17 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 16 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 15 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = faith_minorities_small
                    variable_list_size = {
                        name = faith_minorities_small
                        value > 0
                    }
                    has_variable_list = culture_minorities_small
                    variable_list_size = {
                        name = culture_minorities_small
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_small
                            value > 1
                        }
                        variable_list_size = {
                            name = culture_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 14 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 13 }
                }
                else_if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 12 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 11 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = faith_minorities_large
                    variable_list_size = {
                        name = faith_minorities_large
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 10 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 9 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = culture_minorities_large
                    variable_list_size = {
                        name = culture_minorities_large
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_large
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 8 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 7 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = faith_minorities_small
                    variable_list_size = {
                        name = faith_minorities_small
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = faith_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 6 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 5 }
                }
            }
            else_if = {
                limit = {
                    has_variable_list = culture_minorities_small
                    variable_list_size = {
                        name = culture_minorities_small
                        value > 0
                    }
                }
                if = {
                    limit = {
                        variable_list_size = {
                            name = culture_minorities_small
                            value > 1
                        }
                    }
                    set_color_county_provinces_base = { COLOR = 4 }
                }
                else = {
                    set_color_county_provinces_base = { COLOR = 3 }
                }
            }
            else = {
                every_county_province = {
                    barony = {
                        set_color_from_title = title:d_line_map_base
                    }
                }
            }
        }
    }
}
