diff --git a/lib/thor/line_editor/readline.rb b/lib/thor/line_editor/readline.rb
index 32446e333..df5854d5e 100644
--- a/lib/thor/line_editor/readline.rb
+++ b/lib/thor/line_editor/readline.rb
@@ -17,7 +17,7 @@ def readline
           if complete = completion_proc
             ::Readline.completion_proc = complete
           end
-          ::Readline.readline(prompt, add_to_history?)
+          ::Readline.readline(normalized_prompt, add_to_history?)
         else
           super
         end
@@ -25,6 +25,15 @@ def readline
 
     private
 
+      def normalized_prompt
+        ansi_colors = @prompt[0..-5].scan(/\e\[[0-9;]*m/) \
+                                    .map { |color| "\001" + color + "\002" }
+        return @prompt if ansi_colors.empty?
+
+        @prompt = @prompt.gsub(/\e\[[0-9;]*m/, "")
+        "#{ansi_colors.join}#{prompt}\001\e[0m\002"
+      end
+
       def add_to_history?
         options.fetch(:add_to_history, true)
       end
diff --git a/spec/line_editor/readline_spec.rb b/spec/line_editor/readline_spec.rb
index b2b0712d6..1cd400b93 100644
--- a/spec/line_editor/readline_spec.rb
+++ b/spec/line_editor/readline_spec.rb
@@ -35,6 +35,12 @@
       expect(editor.readline).to eq("foo")
     end
 
+    it "with colored prompt message" do
+      expect(::Readline).to receive(:readline).with("\001\e[32m\002> \001\e[0m\002", true).and_return("foo")
+      editor = Thor::LineEditor::Readline.new("\e[32m> \e[0m", {})
+      expect(editor.readline).to eq("foo")
+    end
+
     it "provides tab completion when given a limited_to option" do
       expect(::Readline).to receive(:readline)
       expect(::Readline).to receive(:completion_proc=) do |proc|
@@ -65,5 +71,6 @@
       editor = Thor::LineEditor::Readline.new("Password: ", :echo => false)
       expect(editor.readline).to eq("secret")
     end
+
   end
 end