Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# woad.Ruby - Changes <!-- omit in toc -->


## 0.0.1 - 15th August 2026

* SGR colour and reset codes (`RESET`, `FG_*`, `BG_*`, including bright variants);


## 0.0.0 - 15th August 2026

* initial project scaffolding;
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# woad.Ruby - News <!-- omit in toc -->

| Date | News Item |
| ---------------- | -------------------------------------------------------------------------------------- |
| 15th August 2026 | [**woad.Ruby** 0.0.1](https://github.com/synesissoftware/woad.Ruby/releases/tag/0.0.1) |
| 15th August 2026 | [**woad.Ruby** 0.0.0](https://github.com/synesissoftware/woad.Ruby/releases/tag/0.0.0) |


<!-- ########################### end of file ########################### -->
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ Use via **require**, as in:

```Ruby
require 'woad'

puts "#{Woad::FG_GREEN}ok#{Woad::RESET}"
```


## Components

**woad.Ruby** currently ships the **`Woad`** root module and version metadata (`require 'woad'`). Colour codes, TTY/stream gating, and Windows virtual-terminal opt-in are not implemented in this 0.0.0 skeleton.
**woad.Ruby** ships SGR string constants (`RESET`, `FG_*`, `BG_*`, including bright variants). TTY/stream gating and Windows virtual-terminal opt-in are not implemented yet.


## Project Information
Expand Down Expand Up @@ -79,6 +81,7 @@ Defect reports, feature requests, and pull requests are welcome on https://githu

### Related projects

* [**woad**](https://github.com/synesissoftware/woad/)
* [**woad.Python**](https://github.com/synesissoftware/woad.Python/)
* [**woad.Rust**](https://github.com/synesissoftware/woad.Rust/)

Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Functional improvements

* [ ] SGR colour and reset codes;
* [x] ~~~SGR colour and reset codes~~~ ✅;
* [ ] TTY-conditional colour codes (process and per-stream);
* [ ] Windows virtual-terminal gating (OS build + `GetConsoleMode`);

Expand Down
47 changes: 47 additions & 0 deletions lib/woad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,53 @@
## Root module for *woad*
module Woad

# Reset

RESET = "\e[0m"

# Foreground (standard)

FG_BLACK = "\e[30m"
FG_RED = "\e[31m"
FG_GREEN = "\e[32m"
FG_YELLOW = "\e[33m"
FG_BLUE = "\e[34m"
FG_MAGENTA = "\e[35m"
FG_CYAN = "\e[36m"
FG_WHITE = "\e[37m"

# Foreground (bright)

FG_BRIGHT_BLACK = "\e[90m"
FG_BRIGHT_RED = "\e[91m"
FG_BRIGHT_GREEN = "\e[92m"
FG_BRIGHT_YELLOW = "\e[93m"
FG_BRIGHT_BLUE = "\e[94m"
FG_BRIGHT_MAGENTA = "\e[95m"
FG_BRIGHT_CYAN = "\e[96m"
FG_BRIGHT_WHITE = "\e[97m"

# Background (standard)

BG_BLACK = "\e[40m"
BG_RED = "\e[41m"
BG_GREEN = "\e[42m"
BG_YELLOW = "\e[43m"
BG_BLUE = "\e[44m"
BG_MAGENTA = "\e[45m"
BG_CYAN = "\e[46m"
BG_WHITE = "\e[47m"

# Background (bright)

BG_BRIGHT_BLACK = "\e[100m"
BG_BRIGHT_RED = "\e[101m"
BG_BRIGHT_GREEN = "\e[102m"
BG_BRIGHT_YELLOW = "\e[103m"
BG_BRIGHT_BLUE = "\e[104m"
BG_BRIGHT_MAGENTA = "\e[105m"
BG_BRIGHT_CYAN = "\e[106m"
BG_BRIGHT_WHITE = "\e[107m"
end # module Woad


Expand Down
2 changes: 1 addition & 1 deletion lib/woad/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
module Woad

# Current version of the woad.Ruby library
VERSION = '0.0.0'
VERSION = '0.0.1'

private
# @!visibility private
Expand Down
42 changes: 42 additions & 0 deletions test/unit/tc_codes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), '../../lib')


require 'woad'

require 'test/unit'


class Test_codes < Test::Unit::TestCase

def test_RESET

assert_equal "\e[0m", Woad::RESET
end

def test_FG_RED

assert_equal "\e[31m", Woad::FG_RED
end

def test_BG_BLUE

assert_equal "\e[44m", Woad::BG_BLUE
end

def test_codes_are_csi_sgr

[
Woad::RESET,
Woad::FG_BLACK,
Woad::FG_BRIGHT_WHITE,
Woad::BG_BLACK,
Woad::BG_BRIGHT_WHITE,
].each do |code|

assert code.start_with?("\e[")
assert code.end_with?('m')
end
end
end
2 changes: 1 addition & 1 deletion woad.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ END_DESC
'source_code_uri' => 'https://github.com/synesissoftware/woad.Ruby',
}

spec.files = Dir[ 'Rakefile', '{bin,examples,lib,man,spec,test}/**/*', 'AUTHORS.md', 'CHANGES.md', 'LICENSE*', 'README*', 'TODO.md' ]
spec.files = Dir[ 'Rakefile', '{bin,examples,lib,man,spec,test}/**/*', 'AUTHORS.md', 'CHANGES.md', 'LICENSE*', 'NEWS.md', 'README*', 'TODO.md' ]
end


Expand Down
Loading