{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8b3a897a",
   "metadata": {},
   "source": [
    "# 07-10 · colormode и цвет\n",
    "\n",
    "Практика к разделу [«colormode и цвет»](../../site/chapters/glava-07/07-10-colormode-i-cvet.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be7ebe59",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить colormode(1.0) и colormode(255), задавать цвета через RGB."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44203356",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0f0ad4c3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:35.550401Z",
     "iopub.status.busy": "2026-08-16T15:16:35.550255Z",
     "iopub.status.idle": "2026-08-16T15:16:35.734988Z",
     "shell.execute_reply": "2026-08-16T15:16:35.734520Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.pensize(3)\n",
    "artist.pencolor(\"#5B24F9\")\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d757bd2",
   "metadata": {},
   "source": [
    "## Рабочий пример\n",
    "\n",
    "RGB в режиме 255."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8de8a5cc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:35.736054Z",
     "iopub.status.busy": "2026-08-16T15:16:35.735942Z",
     "iopub.status.idle": "2026-08-16T15:16:35.864118Z",
     "shell.execute_reply": "2026-08-16T15:16:35.863420Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "screen.colormode(255)\n",
    "artist.pencolor(255, 0, 0)\n",
    "artist.forward(100)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "059b27d5",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "В режиме colormode(255) нарисуйте линию длиной 120 цветом (0, 150, 0) — зелёным."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6b363624",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:35.865122Z",
     "iopub.status.busy": "2026-08-16T15:16:35.865014Z",
     "iopub.status.idle": "2026-08-16T15:16:36.013611Z",
     "shell.execute_reply": "2026-08-16T15:16:36.013025Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "screen.colormode(255)\n",
    "artist.pencolor(0, 150, 0)\n",
    "artist.forward(120)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eaa5e7c9",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f844ff8a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T15:16:36.014672Z",
     "iopub.status.busy": "2026-08-16T15:16:36.014569Z",
     "iopub.status.idle": "2026-08-16T15:16:36.017715Z",
     "shell.execute_reply": "2026-08-16T15:16:36.017168Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle закрыто.\n"
     ]
    }
   ],
   "source": [
    "screen.bye()\n",
    "print(\"Окно Turtle закрыто.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "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.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
