Debian Codegraph @

ui-tests-ipw7/tests/notebooks/themes_update.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "id": "4bbf0955",
7 "metadata": {},
8 "outputs": [
9 {
10 "data": {
11 "application/vnd.jupyter.widget-view+json": {
12 "model_id": "c6eb1b8643d54018b257c66a97efeb37",
13 "version_major": 2,
14 "version_minor": 0
15 },
16 "text/plain": [
17 "DataGrid(auto_fit_params={'area': 'all', 'padding': 30, 'numCols': None}, corner_renderer=None, default_render…"
18 ]
19 },
20 "metadata": {},
21 "output_type": "display_data"
22 }
23 ],
24 "source": [
25 "import pandas as pd\n",
26 "import numpy as np\n",
27 "import ipydatagrid as grid\n",
28 "\n",
29 "np.random.seed(104)\n",
30 "rang = 10\n",
31 "df = pd.DataFrame(\n",
32 " data=[np.random.randint(0, 11, rang) for i in range(rang)],\n",
33 " index=[f\"Row {i}\" for i in range(rang)],\n",
34 " columns=[f\"Col {i}\" for i in range(rang)],\n",
35 ")\n",
36 "\n",
37 "g = grid.DataGrid(\n",
38 " df, layout={\"height\": \"300px\", \"width\": \"800px\"}, selection_mode=\"cell\"\n",
39 ")\n",
40 "g"
41 ]
42 },
43 {
44 "cell_type": "code",
45 "execution_count": 2,
46 "id": "ccd78ce4",
47 "metadata": {},
48 "outputs": [],
49 "source": [
50 "monokai = {\n",
51 " \"background_color\": \"#2c292d\",\n",
52 " \"grid_line_color\": \"#a698eb7a\",\n",
53 " \"header_background_color\": \"#2c292d9a\",\n",
54 " \"header_grid_line_color\": \"#fc98675a\",\n",
55 " \"selection_fill_color\": \"#78dce81a\",\n",
56 " \"selection_border_color\": \"#ffd866\",\n",
57 " \"header_selection_fill_color\": \"#ab9df24a\",\n",
58 " \"header_selection_border_color\": \"lawngreen\",\n",
59 " \"cursor_fill_color\": \"#78dce87a\",\n",
60 " \"cursor_border_color\": \"#ff6188\",\n",
61 "}\n",
62 "\n",
63 "g.grid_style = monokai"
64 ]
65 },
66 {
67 "cell_type": "code",
68 "execution_count": 3,
69 "id": "3901bc22",
70 "metadata": {},
71 "outputs": [],
72 "source": [
73 "cotton_candy = {\n",
74 " \"background_color\": \"rgb(255, 245, 251)\",\n",
75 " \"header_background_color\": \"rgb(207, 212, 252, 1)\",\n",
76 " \"header_grid_line_color\": \"rgb(0, 247, 181, 0.9)\",\n",
77 " \"vertical_grid_line_color\": \"rgb(0, 247, 181, 0.3)\",\n",
78 " \"horizontal_grid_line_color\": \"rgb(0, 247, 181, 0.3)\",\n",
79 " \"selection_fill_color\": \"rgb(212, 245, 255, 0.3)\",\n",
80 " \"selection_border_color\": \"rgb(78, 174, 212)\",\n",
81 " \"header_selection_fill_color\": \"rgb(212, 255, 239, 0.3)\",\n",
82 " \"header_selection_border_color\": \"rgb(252, 3, 115)\",\n",
83 " \"cursor_fill_color\": \"rgb(186, 32, 186, 0.2)\",\n",
84 " \"cursor_border_color\": \"rgb(191, 191, 78)\",\n",
85 "}\n",
86 "\n",
87 "g.grid_style = cotton_candy"
88 ]
89 },
90 {
91 "cell_type": "code",
92 "execution_count": 4,
93 "id": "7af7688c",
94 "metadata": {},
95 "outputs": [],
96 "source": [
97 "watermelon = {\n",
98 " \"column_background_color\": grid.VegaExpr(\n",
99 " \"cell % 2 === 0 ? 'rgb(255, 130, 145, 0.5)' : 'rgb(255, 130, 145, 0.2)'\"\n",
100 " ),\n",
101 " \"header_vertical_grid_line_color\": \"rgb(0, 140, 86, 0.8)\",\n",
102 " \"header_horizontal_grid_line_color\": \"rgb(0, 140, 86, 0.4)\",\n",
103 " \"vertical_grid_line_color\": \"rgb(176, 176, 176)\",\n",
104 " \"horizontal_grid_line_color\": \"rgb(0, 247, 181, 0)\",\n",
105 " \"selection_fill_color\": \"rgb(235, 223, 7, 0.3)\",\n",
106 " \"selection_border_color\": \"rgb(201, 219, 7)\",\n",
107 " \"header_selection_fill_color\": \"rgb(235, 223, 7, 0.4)\",\n",
108 " \"header_selection_border_color\": \"rgb(252, 3, 115)\",\n",
109 " \"cursor_fill_color\": \"rgb(235, 7, 113, 0.4)\",\n",
110 " \"cursor_border_color\": \"rgb(6, 191, 58, 0.9)\",\n",
111 "}\n",
112 "\n",
113 "\n",
114 "g.grid_style = watermelon\n",
115 "g.corner_renderer = grid.TextRenderer(\n",
116 " background_color=\"rgb(250, 242, 130)\", text_color=\"black\"\n",
117 ")\n",
118 "g.header_renderer = grid.TextRenderer(\n",
119 " background_color=grid.VegaExpr(\n",
120 " \"cell.column % 2 === 0 ? 'rgb(34, 110, 29)': 'rgb(24, 150, 19)'\"\n",
121 " ),\n",
122 " text_color=\"white\",\n",
123 ")\n",
124 "g.renderers = {\n",
125 " \"key\": grid.TextRenderer(\n",
126 " background_color=grid.VegaExpr(\n",
127 " \"cell.row % 2 === 0 ? 'rgb(21, 116, 163)': 'rgb(21, 116, 163)'\"\n",
128 " ),\n",
129 " text_color=\"white\",\n",
130 " )\n",
131 "}"
132 ]
133 }
134 ],
135 "metadata": {
136 "kernelspec": {
137 "display_name": "Python 3 (ipykernel)",
138 "language": "python",
139 "name": "python3"
140 },
141 "language_info": {
142 "codemirror_mode": {
143 "name": "ipython",
144 "version": 3
145 },
146 "file_extension": ".py",
147 "mimetype": "text/x-python",
148 "name": "python",
149 "nbconvert_exporter": "python",
150 "pygments_lexer": "ipython3",
151 "version": "3.9.9"
152 }
153 },
154 "nbformat": 4,
155 "nbformat_minor": 5
156 }