{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Switch to a dark theme\n",
"\n",
"By default, CARTOframes uses Positron, a light basemap with light themed widget and legend panels. When the basemap is swithed to Dark Matter and legends and widgets are present, the theme updates accordingly.\n",
"\n",
"In the example below, by setting the `basemap` parameter to `darkmatter`, all map components switch to a dark theme that is better suited for the dark basemap."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from cartoframes.auth import set_default_credentials\n",
"from cartoframes.viz import Map, Layer, basemaps, color_category_style\n",
"\n",
"set_default_credentials('cartoframes')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Map(\n",
" Layer(\n",
" 'pittsburgh_311',\n",
" color_category_style('request_type', top=3, palette='[#4ABD9A,#4A5798,#F9CA34]'),\n",
" title=\"Requests\"\n",
" ),\n",
" basemap=basemaps.darkmatter\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}