summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-11 20:52:31 +0100
committerhut <hut@lavabit.com>2010-03-12 00:46:47 +0100
commita0fdb913401a6f28b1dfbca248d41c147b12cd20 (patch)
tree76d9cb487a46b8d20e87ddfcd57c0ca3250a9ebc /ranger
parent0128bee71f734138d3f49f56092688bb0623c6a2 (diff)
downloadranger-a0fdb913401a6f28b1dfbca248d41c147b12cd20.tar.gz
added two new colorschemes using 88 colors
Diffstat (limited to 'ranger')
-rw-r--r--ranger/colorschemes/default88.py59
-rw-r--r--ranger/colorschemes/texas.py73
-rw-r--r--ranger/defaults/options.py12
3 files changed, 136 insertions, 8 deletions
diff --git a/ranger/colorschemes/default88.py b/ranger/colorschemes/default88.py
new file mode 100644
index 00000000..b78d1bb5
--- /dev/null
+++ b/ranger/colorschemes/default88.py
@@ -0,0 +1,59 @@
+# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+The default colorscheme, using 88 colors.
+
+For now, just map each of the 8 base colors to new ones
+for brighter blue, etc. and do some minor modifications.
+"""
+
+from ranger.gui.colorscheme import ColorScheme
+from ranger.gui.color import *
+
+from ranger.colorschemes.default import Default
+import curses
+
+class Scheme(Default):
+	def use(self, context):
+		fg, bg, attr = Default.use(self, context)
+
+		if curses.COLORS != 88:
+			return fg, bg, attr
+
+		try:
+			translate = {
+				blue: 22,
+				yellow: 72,
+				green: 20,
+				cyan: 21,
+				white: 79,
+				red: 32,
+				magenta: magenta,
+			}
+			fg = translate[fg]
+		except KeyError:
+			pass
+
+		if context.in_browser:
+			if context.main_column and context.marked:
+				if context.selected:
+					fg = 77
+				else:
+					fg = 68
+					attr |= reverse
+
+		return fg, bg, attr
+
diff --git a/ranger/colorschemes/texas.py b/ranger/colorschemes/texas.py
new file mode 100644
index 00000000..93fd4791
--- /dev/null
+++ b/ranger/colorschemes/texas.py
@@ -0,0 +1,73 @@
+# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Some experimental colorscheme.
+"""
+
+from ranger.gui.colorscheme import ColorScheme
+from ranger.gui.color import *
+
+from ranger.colorschemes.default import Default
+import curses
+
+class Scheme(Default):
+	def use(self, context):
+		fg, bg, attr = Default.use(self, context)
+
+		if curses.COLORS < 88:
+			return fg, bg, attr
+
+		dircolor = 77
+		dircolor_selected = {True: 79, False: 78}
+		linkcolor = {True: 21, False: 48}
+
+		if context.in_browser:
+			if context.media:
+				if context.image:
+					fg = 20
+				elif context.video:
+					fg = 22
+				elif context.audio:
+					fg = 23
+
+			if context.container:
+				fg = 32
+			if context.directory:
+				fg = dircolor
+				if context.selected:
+					fg = dircolor_selected[context.main_column]
+			elif context.executable and not \
+					any((context.media, context.container)):
+				fg = 82
+			if context.link:
+				fg = linkcolor[context.good]
+
+			if context.main_column:
+				if context.selected:
+					attr |= bold
+				if context.marked:
+					attr |= bold
+					fg = 53
+
+		if context.in_titlebar:
+			if context.hostname:
+				fg = context.bad and 48 or 82
+			elif context.directory:
+				fg = dircolor
+			elif context.link:
+				fg = linkcolor[True]
+
+		return fg, bg, attr
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 8711f737..34e0c37e 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -21,14 +21,10 @@ intact and the type of the value stays the same.
 
 from ranger.api.options import *
 
-# Which colorscheme to use?  There are these by default:
-# colorschemes.texas
-# colorschemes.jungle
-# colorschemes.default
-# colorschemes.snow
-# Texas uses 88 colors. If they are not supported, it will fall back
-# to the default scheme.
-colorscheme = colorschemes.texas
+# Which colorscheme to use?  These colorschemes are available by default:
+# default, default88, texas, jungle, snow
+# Snow is monochrome, texas and default88 use 88 colors.
+colorscheme = colorschemes.default
 
 max_history_size = 20
 scroll_offset = 2
a> 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519