1# This file is part of MyPaint. 2# Copyright (C) 2014 by Andrew Chadwick <a.t.chadwick@gmail.com> 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 2 of the License, or 7# (at your option) any later version. 8 9"""Graphical style constants for on-canvas editable objects 10 11This covers things like the frame outlines, or the axis of symmetry. 12Using a consistent set of colors, widths, and sizes helps provide 13a unified graphical experience. 14 15See also: gui.drawutils 16 17""" 18 19from __future__ import division, print_function 20 21from lib.color import HCYColor, RGBColor 22 23 24## Alpha checks (chequerboard pattern) 25 26ALPHA_CHECK_SIZE = 16 27ALPHA_CHECK_COLOR_1 = (0.45, 0.45, 0.45) 28ALPHA_CHECK_COLOR_2 = (0.50, 0.50, 0.50) 29 30 31## Floating action buttons (rendered on the canvas) 32 33FLOATING_BUTTON_ICON_SIZE = 16 34FLOATING_BUTTON_RADIUS = 16 35 36 37## Draggable line and handle sizes 38 39DRAGGABLE_POINT_HANDLE_SIZE = 4 40DRAGGABLE_EDGE_WIDTH = 2 41 42 43## Paint-chip style 44 45PAINT_CHIP_HIGHLIGHT_HCY_Y_MULT = 1.1 46PAINT_CHIP_HIGHLIGHT_HCY_C_MULT = 1.1 47PAINT_CHIP_SHADOW_HCY_Y_MULT = 0.666 48PAINT_CHIP_SHADOW_HCY_C_MULT = 0.5 49 50 51## Drop shadow layout and weight 52 53DROP_SHADOW_ALPHA = 0.5 54DROP_SHADOW_BLUR = 2.0 55DROP_SHADOW_X_OFFSET = 0.0 56DROP_SHADOW_Y_OFFSET = 0.5 57# These are only used for otherwise flat editable or draggable objects. 58 59 60## Colors for additional on-canvas information 61 62# Transient on-canvas information, intended to be read quickly. 63# Used for fading textual info or vanishing positional markers. 64# Need to be high-contrast, and clear. Black and white is good. 65 66TRANSIENT_INFO_BG_RGBA = (0, 0, 0, 0.666) #: Transient text bg / outline 67TRANSIENT_INFO_RGBA = (1, 1, 1, 1) #: Transient text / marker 68 69 70# Editable on-screen items. 71# Used for editable handles on things like the document frame, 72# when it's being edited. 73# It's a good idea to use this and a user-tuneable alpha if the item 74# is to be shown on screen permanently, in modes other than the object's 75# own edit mode. 76 77EDITABLE_ITEM_COLOR = RGBColor.new_from_hex_str("#ECF0F1") 78 79 80# Active/dragging state for editable items. 81 82ACTIVE_ITEM_COLOR = RGBColor.new_from_hex_str("#F1C40F") 83 84 85# Prelight color (for complex modes, when there needs to be a distinction) 86 87PRELIT_ITEM_COLOR = tuple( 88 ACTIVE_ITEM_COLOR.interpolate(EDITABLE_ITEM_COLOR, 3) 89 )[1] 90 91